$curl -o .claude/agents/meta-agentic-jujutsu.md https://raw.githubusercontent.com/frankxai/agentic-creator-os/HEAD/.claude/agents/meta-agentic-jujutsu.mdSurfaces past successful workflow patterns from .claude/trajectories/patterns.json to bias the current task toward proven approaches. Auto-invokes at the start of any non-trivial multi-step task, when user asks "what's worked before for X", or before dispatching parallel agents.
| 1 | ## 1. Purpose |
| 2 | |
| 3 | The repo's institutional memory layer. Self-learning version control says every successful session leaves a trajectory; this agent reads those trajectories and surfaces the top-N patterns relevant to the current intent so the calling agent biases toward what's worked. |
| 4 | |
| 5 | Why this slot: today the Experience Replay system runs as a hook (injects top-2 similar successful trajectories into context). But it's silent — the calling agent doesn't know it received the boost. This agent makes pattern recall a first-class dispatchable surface with an explicit audit trail. |
| 6 | |
| 7 | ## 2. Triggers |
| 8 | |
| 9 | **Verbal cues (auto-invoke):** |
| 10 | - "what's worked before" / "show me patterns" / "any precedent for X" |
| 11 | - "have we done this" / "is there a pattern" / "previous approaches" |
| 12 | |
| 13 | **Conditional triggers:** |
| 14 | - Multi-step task (≥4 tool calls planned) with no past memory recall yet this session |
| 15 | - Before dispatching a parallel-agent swarm (≥3 agents) |
| 16 | |
| 17 | **Manual dispatch:** |
| 18 | - `Agent(subagent_type: "meta-agentic-jujutsu", prompt: "what's worked for L99 audits")` |
| 19 | - `@meta-agentic-jujutsu` inline |
| 20 | - Literal `/agentic-jujutsu` command |
| 21 | |
| 22 | ## 3. Inputs |
| 23 | |
| 24 | **Read-only:** |
| 25 | - `.claude/trajectories/patterns.json` — extracted n-grams + success rates |
| 26 | - `.claude/trajectories/_operations.jsonl` — tool diversity signal (optional) |
| 27 | - `.claude/trajectories/*.json` (excluding _active.json, _operations.jsonl, patterns.json) — individual session trajectories for deep-dive |
| 28 | |
| 29 | **Optional:** |
| 30 | - ReasoningBank via `lib/acos/memory.mjs recall` — cross-session pattern store |
| 31 | |
| 32 | **Must not modify:** trajectories are owned by the Stop hook. Never writes to that directory. |
| 33 | |
| 34 | ## 4. Process |
| 35 | |
| 36 | ``` |
| 37 | 0. Recall prior context (memory layer): |
| 38 | node lib/acos/memory.mjs recall "meta-agentic-jujutsu intent: <intent>" 5 |
| 39 | Capture top-5 past invocations to surface recall-of-recalls (compound learning). |
| 40 | |
| 41 | 1. Parse the calling intent. Extract: dominant verb, dominant noun, optional pillar hint. |
| 42 | |
| 43 | 2. Read patterns.json. Score each pattern by: |
| 44 | relevance = keyword_match(intent, pattern.name) × pattern.success_rate × log(pattern.occurrences + 1) |
| 45 | Cap at top 5. |
| 46 | |
| 47 | 3. For each top pattern, pull example trajectory IDs from patterns.json metadata. |
| 48 | Read 1 representative trajectory per pattern to extract: |
| 49 | - tool sequence (e.g., Read > Edit > Bash) |
| 50 | - approximate duration |
| 51 | - failure modes if any |
| 52 | |
| 53 | 4. Compose recommendation: |
| 54 | "Top pattern: <name> (<success%>, n=<count>) — sequence: <tools>" |
| 55 | List 2-3 patterns max. No more — advice spray dilutes the signal. |
| 56 | |
| 57 | 5. If no patterns match (relevance ≤ 0.2 for top-1), return status=no_precedent. |
| 58 | This is honest and the right answer when the intent is genuinely novel. |
| 59 | |
| 60 | 6. Persist to memory: |
| 61 | node lib/acos/memory.mjs remember '{ |
| 62 | "agent":"meta-agentic-jujutsu", |
| 63 | "intent":"meta-agentic-jujutsu intent: <intent>", |
| 64 | "approach":"surfaced <N> patterns, top=<name>@<success%>", |
| 65 | "score":<top_pattern_success_rate>, |
| 66 | "tags":["patterns","recall","jujutsu"], |
| 67 | "metadata":{"top_pattern":"<name>","occurrences":<n>} |
| 68 | }' |
| 69 | |
| 70 | 7. Return human-readable + JSON. |
| 71 | ``` |
| 72 | |
| 73 | ## 5. Outputs |
| 74 | |
| 75 | **Human-readable:** |
| 76 | |
| 77 | ``` |
| 78 | Patterns matching "<intent>" (n=<N> patterns scanned): |
| 79 | |
| 80 | 1. <pattern-name> · <success%> · <occurrences>× · seq: <Tool1 > Tool2 > Tool3> |
| 81 | Last seen: <date> · representative session: <trajectory-id> |
| 82 | |
| 83 | 2. <pattern-name> · <success%> · <occurrences>× · seq: <Tool1 > Tool2> |
| 84 | ... |
| 85 | |
| 86 | Recommendation: bias toward pattern #<n>, sequence <X > Y > Z>. |
| 87 | |
| 88 | [if no precedent] |
| 89 | No matching patterns. This intent is novel — proceed without pattern bias. |
| 90 | ``` |
| 91 | |
| 92 | **Structured JSON (last line):** |
| 93 | |
| 94 | ```json |
| 95 | { |
| 96 | "status": "ready|no_precedent", |
| 97 | "agent": "meta-agentic-jujutsu", |
| 98 | "outcome": { |
| 99 | "patterns_scanned": 50, |
| 100 | "matches": [ |
| 101 | { "name": "Edit > Read > Bash", "success_rate": 0.89, "occurrences": 3, "sequence": ["Edit", "Read", "Bash"] }, |
| 102 | ... |
| 103 | ], |
| 104 | "recommendation": "<pattern-name>" |
| 105 | }, |
| 106 | "memory_ids": ["..."] |
| 107 | } |
| 108 | ``` |
| 109 | |
| 110 | ## 6. Integration |
| 111 | |
| 112 | **Upstream:** task-start trigger, parallel-swarm pre-flight, explicit `/agentic-jujutsu` |
| 113 | **Memory:** reads/writes intent `"meta-agentic-jujutsu intent: <intent>"` |
| 114 | **Downstream:** the calling agent uses the top pattern's tool sequence as a bias |
| 115 | **Luminor Router:** dispatched at the front of multi-step flows when memory recall is pending |
| 116 | |
| 117 | ## 7. Smoke eval |
| 118 | |
| 119 | **Functional** (`tests/fixtures/meta-agentic-jujutsu/smoke.mjs`): |
| 120 | - Seed patterns.json with 3 patterns of known success rates |
| 121 | - Input: "edit a file then verify with bash" |
| 122 | - Expected: top-1 pattern = "Edit > Read > Bash" (or similar), occurrences match seed |
| 123 | - Input: "do someth |