@engramlabs/mcp 0.1.2-alpha → 0.1.4-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,84 @@
1
+ # Plan workflow: STORY / FEATURE
2
+
3
+ New capability work. The mine-first discipline matters most here:
4
+ stories die from unknown unknowns, and the index is where the unknowns
5
+ are already written down.
6
+
7
+ ## When this workflow
8
+ - New feature, story, or capability request
9
+ - Refactor with a goal (not a bug, not a rename)
10
+ - Integration of a new component
11
+
12
+ ## Steps
13
+
14
+ ### 1. Search the past — patterns, precedents, near-misses
15
+ ```
16
+ recall({ "query": "<feature domain terms> design decisions" })
17
+ search({ "query": "<adjacent existing capability>" })
18
+ procedure_list({})
19
+ ```
20
+ Mine for:
21
+ - **Precedents**: was a similar feature planned/built/abandoned
22
+ before? (abandoned plans + their reasons are gold)
23
+ - **Invariants** the feature must respect (indexed `[proven]` rules)
24
+ - **Adjacent patterns**: how does this repo solve analogous problems?
25
+ (find the closest existing feature and mirror its shape)
26
+ - **Open tensions**: `contradiction_list({})` — building on top of an
27
+ unresolved contradiction is planning to fail
28
+
29
+ ### 2. Map the integration surface
30
+ ```
31
+ architecture({ "limit": 15 })
32
+ symbol_context({ "symbol": "<primary touchpoint>", "depth": 2 })
33
+ change_impact({ "target": "<each touchpoint>" })
34
+ ```
35
+ - Where does the feature ATTACH? (ports, facades, tool registries)
36
+ - What must NOT move? (bridges, invariants)
37
+ - Which layers does it cross? (crossing layers = the plan needs
38
+ explicit steps per layer, or it will stop at the first boundary)
39
+
40
+ ### 3. Design in the repo's shape
41
+ One paragraph: the feature in this repo's own vocabulary, mirroring
42
+ the closest existing pattern found in step 1. A design that invents a
43
+ new shape when a proven one exists needs a stated reason (that's an
44
+ Open Question, not a surprise).
45
+
46
+ ### 4. Steps with per-layer verification
47
+ Each step lands ONE layer and names its verify command:
48
+ ```
49
+ 1. Domain types + contracts (core/<crate>)
50
+ Verify: cargo check -p engram-<crate> + check-contracts.sh
51
+ 2. Adapter behavior (adapters/<area>)
52
+ Verify: cargo test -p engram-<adapter>
53
+ 3. Facade/registry wiring
54
+ Verify: <the exact test that proves reachability>
55
+ 4. Agent surface (tool/skill/README)
56
+ Verify: <driver call or surface-parity check>
57
+ ```
58
+ Steps without a verify command are wishes, not steps.
59
+
60
+ ### 5. Persist the plan AND the workflow
61
+ ```
62
+ write_memory({ "content": "PLAN <slug>: <overview>. Precedents mined:
63
+ <what step 1 found>. Top risks: <...>. Steps: <N>, per-layer verify." })
64
+ ```
65
+ If this feature type recurs, the successful shape becomes a procedure:
66
+
67
+ ```
68
+ procedure_put({ "name": "add-<feature-type>",
69
+ "trigger": "new <feature-type> request",
70
+ "steps": ["<mine precedents>", "<map surface>", "<per-layer steps>",
71
+ "<verify each>", "<learn pass>"] })
72
+ ```
73
+
74
+ ## Output
75
+ Overview / Findings (with the precedent search result — including
76
+ "none found") / Risks (invariants + bridges) / Steps (per-layer) /
77
+ Open Questions.
78
+
79
+ ## Stop conditions
80
+ - Design contradicts an indexed `[proven]` invariant → stop; either
81
+ the invariant is wrong (an ADR-level change — say so) or the design
82
+ is. Don't plan past a contradiction.
83
+ - No precedent found AND high blast radius → the first plan step is a
84
+ spike/prototype, explicitly labeled as such.
@@ -0,0 +1,54 @@
1
+ # Plan workflow: TRIAGE
2
+
3
+ Rapid assessment of a reported problem. Triage does NOT fix — it
4
+ classifies and routes. Time-boxed: if this takes more than a few tool
5
+ calls, it's a bugfix, not a triage.
6
+
7
+ ## When this workflow
8
+ - A bug/error report arrives with unclear severity
9
+ - CI is red and nobody knows why
10
+ - "Something is broken" with no repro
11
+
12
+ ## Steps
13
+
14
+ ### 1. Reproduce (or fail to, honestly)
15
+ Run the failing thing. If you cannot reproduce, that IS the triage
16
+ output: "not reproducible as described; likely <hypothesis [likely]>".
17
+
18
+ ### 2. Search the past (engram-search core move)
19
+ ```
20
+ recall({ "query": "<error text core terms>" })
21
+ search({ "query": "<failing symbol or area>" })
22
+ procedure_list({})
23
+ ```
24
+ - Has this exact failure happened before? (past fixes = fastest path)
25
+ - Is there a known sharp edge here? (indexed `[proven]` memory)
26
+ - Is there a runbook that already covers it?
27
+
28
+ ### 3. Classify
29
+
30
+ | Class | Criteria | Route |
31
+ |---|---|---|
32
+ | Known + runbook exists | recall hit + procedure covers it | Follow the procedure; skip planning |
33
+ | Known pattern, no runbook | similar past fix recalled | plan-bugfix (fast lane — the pattern is known) |
34
+ | New failure mode | no past hits | plan-bugfix full workflow |
35
+ | Not a bug (works as designed) | repro shows intended behavior | Report; maybe docs/engram-learn |
36
+ | Severity: blocks release/CI | red main, broken publish | plan-bugfix immediately + flag urgency |
37
+
38
+ ### 4. Record the triage
39
+ ```
40
+ write_memory({ "content": "TRIAGE <one-line>: <report> → <class>.
41
+ Root-cause hypothesis: <...> [likely]. Past evidence: <recall hit or
42
+ 'none'>" })
43
+ ```
44
+ If a runbook WAS missing but would have helped, note that — it feeds
45
+ engram-learn later.
46
+
47
+ ## Output
48
+ One paragraph: what was reported, what reproduced, the class, the
49
+ route, the hypothesis. No fix, no plan steps — routing only.
50
+
51
+ ## Stop conditions
52
+ - Cannot reproduce → report that, stop.
53
+ - Runbook found → execute it, stop (that's not triage anymore).
54
+ - Classification clear → hand to plan-bugfix, stop.
@@ -0,0 +1,100 @@
1
+ ---
2
+ name: engram-search
3
+ description: Agentic search over the code graph and memory to find or solve problems — "where is X", "how does Y work", "why did Z break", "find the code that...". An iterative hypothesis→retrieve→verify loop, not a one-shot lookup. Trigger on any codebase question where the answer should be evidenced.
4
+ ---
5
+
6
+ # engram-search
7
+
8
+ Answer codebase questions with evidence. A loop: **hypothesis → retrieve
9
+ → verify → refine**. Stop when the claim is `[proven]` — or honestly
10
+ unproven.
11
+
12
+ ## Contract
13
+
14
+ 1. Never claim file contents from memory alone — verify with `fetch_content`.
15
+ 2. Every claim in the answer carries its evidence: the tool + query that proved it.
16
+ 3. Two fruitless iterations → say what you looked for and stop.
17
+ 4. Labels: `[proven]` (verified against source/graph), `[likely]` (strong signal, unverified), `[guessed]` (hypothesis only — say so).
18
+
19
+ ## Workflow
20
+
21
+ ### 1. State the hypothesis
22
+
23
+ Before any tool call, write one line: *"I expect X lives in Y because Z."*
24
+ This anchors the search and makes refinement measurable.
25
+
26
+ ### 2. Retrieve from two angles
27
+
28
+ ```
29
+ recall({ "query": "<the question's key terms>" })
30
+ search({ "query": "<the likely symbol/term name>" })
31
+ ```
32
+
33
+ `recall` covers memories + knowledge + docs (the "why"); `search` covers
34
+ the code graph (the "where").
35
+
36
+ ### 3. Drill the neighborhood
37
+
38
+ For the best candidate symbol:
39
+
40
+ ```
41
+ symbol_context({ "symbol": "<name>", "depth": 2 })
42
+ ```
43
+
44
+ For an area rather than a symbol:
45
+
46
+ ```
47
+ explore({ "query": "<area terms>", "depth": 2 })
48
+ ```
49
+
50
+ ### 4. Verify against source
51
+
52
+ Before asserting what code does:
53
+
54
+ ```
55
+ fetch_content({ "path": "<file path from the graph>" })
56
+ ```
57
+
58
+ Graph and memory say where; the file says what. If they disagree, the
59
+ index is stale — say so (`[likely]` at best).
60
+
61
+ ### 5. Refine or stop
62
+
63
+ - Found and verified → answer.
64
+ - Found but unverified → answer with `[likely]`, offer to fetch.
65
+ - Nothing → refine the query with terms the graph revealed (community
66
+ names, related symbols), one more iteration. After two empty
67
+ iterations, report the queries tried and stop.
68
+
69
+ ## Output format
70
+
71
+ ```
72
+ <answer, one paragraph>
73
+
74
+ Evidence:
75
+ - [proven] <claim> — symbol_context(X): called by A, B; fetch_content(file.rs)
76
+ - [likely] <claim> — recall hit "…" (indexed Oct 2026; may be stale)
77
+ - [guessed] <claim> — naming convention only
78
+ ```
79
+
80
+ ## When it fails
81
+
82
+ - Empty store (no index yet) → say "not indexed; run engram-index or
83
+ scan_repo first" and stop. Do not fall back to grepping as if indexed.
84
+ - Stale-index signals (symbols that no longer exist per `fetch_content`) →
85
+ flag the staleness in the answer; suggest `scan_repo`.
86
+ - Ambiguous symbol (many same-name entities) → disambiguate with
87
+ `symbol_context` per candidate, or ask; don't average.
88
+
89
+ ## Anti-patterns
90
+
91
+ - Claiming behavior from memory alone (no `fetch_content`).
92
+ - One query, one give-up.
93
+ - Answering from general language knowledge instead of this repo's graph.
94
+ - Skipping the hypothesis line.
95
+
96
+ ## Final check
97
+
98
+ - Is every claim labeled?
99
+ - Did I read the actual file for the load-bearing claims?
100
+ - Would the evidence chain convince a skeptical reviewer?