Rule Lifecycle (DRAFT -> SHADOW -> ACTIVE)
This repo stores rule state in memory_rule_defs.state.
Recommended Promotion Policy (MVP)
- DRAFT -> SHADOW:
- at least N=3 positive feedback events across distinct
run_ids - and
negative_count= 0
- at least N=3 positive feedback events across distinct
- SHADOW -> ACTIVE:
- at least N=10 positives
- and negatives/positives ratio < 0.1
- Any -> DISABLED:
- explicit user disable
- or a high-severity negative signal
The exact thresholds should be configurable (environment or DB table later).
Offline Helper: Promotion Suggestions
This repo includes a read-only job that scans SHADOW rules and lists those that meet the configured thresholds:
bash
npm run job:rule-promotion-suggestIt does not mutate rule state. To promote, call POST /v1/memory/rules/state.
Feedback Capture
Write a memory_rule_feedback row when:
- a rule suggestion was used and the run succeeded (positive)
- a rule suggestion caused a failure/rollback (negative)
- ambiguous outcome (neutral)
For strict auditability, each feedback should be tied to a memory_commit.
Execution Injection
Rules become "execution-relevant" when they are in SHADOW or ACTIVE.
- Use
POST /v1/memory/rules/evaluateto match rules against a planner/tool-selectorcontextobject. - Only
then_jsonfrom matched rules should be injected into your execution system. then_jsonis intentionally constrained to a minimal, strict policy patch schema (seedocs/API_CONTRACT.md) so it remains stable and safe to apply automatically.- If a rule node is
memory_lane=private, it must have an explicit owner (owner_agent_idorowner_team_id) before it can be promoted intoSHADOW/ACTIVE.