wyrm-mcp 7.2.4 → 7.3.1

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.
Files changed (57) hide show
  1. package/BENCHMARKS.md +57 -0
  2. package/README.md +5 -3
  3. package/dist/autoconfig.d.ts.map +1 -1
  4. package/dist/autoconfig.js +17 -17
  5. package/dist/autoconfig.js.map +1 -1
  6. package/dist/causality.d.ts +21 -0
  7. package/dist/causality.d.ts.map +1 -1
  8. package/dist/causality.js +12 -6
  9. package/dist/causality.js.map +1 -1
  10. package/dist/content-signature.d.ts +33 -0
  11. package/dist/content-signature.d.ts.map +1 -0
  12. package/dist/content-signature.js +1 -0
  13. package/dist/content-signature.js.map +1 -0
  14. package/dist/failure-patterns.d.ts +15 -0
  15. package/dist/failure-patterns.d.ts.map +1 -1
  16. package/dist/failure-patterns.js +26 -20
  17. package/dist/failure-patterns.js.map +1 -1
  18. package/dist/handlers/capture.d.ts.map +1 -1
  19. package/dist/handlers/capture.js +57 -57
  20. package/dist/handlers/capture.js.map +1 -1
  21. package/dist/handlers/causality.d.ts.map +1 -1
  22. package/dist/handlers/causality.js +7 -5
  23. package/dist/handlers/causality.js.map +1 -1
  24. package/dist/handlers/failure.d.ts.map +1 -1
  25. package/dist/handlers/failure.js +5 -5
  26. package/dist/handlers/failure.js.map +1 -1
  27. package/dist/handlers/recall.d.ts.map +1 -1
  28. package/dist/handlers/recall.js +11 -9
  29. package/dist/handlers/recall.js.map +1 -1
  30. package/dist/handlers/run.d.ts +44 -0
  31. package/dist/handlers/run.d.ts.map +1 -1
  32. package/dist/handlers/run.js +10 -12
  33. package/dist/handlers/run.js.map +1 -1
  34. package/dist/importers.d.ts +77 -0
  35. package/dist/importers.d.ts.map +1 -0
  36. package/dist/importers.js +1 -0
  37. package/dist/importers.js.map +1 -0
  38. package/dist/migrations.d.ts.map +1 -1
  39. package/dist/migrations.js +1 -1
  40. package/dist/migrations.js.map +1 -1
  41. package/dist/receipt.d.ts +45 -0
  42. package/dist/receipt.d.ts.map +1 -0
  43. package/dist/receipt.js +1 -0
  44. package/dist/receipt.js.map +1 -0
  45. package/dist/render-target.d.ts +15 -1
  46. package/dist/render-target.d.ts.map +1 -1
  47. package/dist/render-target.js +11 -11
  48. package/dist/render-target.js.map +1 -1
  49. package/dist/tool-manifest-v2.json +1 -1
  50. package/dist/tool-manifest.json +1 -1
  51. package/dist/wyrm-cli.js +45 -42
  52. package/dist/wyrm-cli.js.map +1 -1
  53. package/dist/wyrm-guard.d.ts.map +1 -1
  54. package/dist/wyrm-guard.js +13 -13
  55. package/dist/wyrm-guard.js.map +1 -1
  56. package/dist/wyrm-manifest.json +1 -1
  57. package/package.json +2 -1
@@ -1,4 +1,4 @@
1
- import{sanitizeFtsQuery as I}from"./security.js";import{emitEvent as b,isLiveMemoryEnabled as A}from"./events.js";import{getActor as E,hasExplicitAttribution as j}from"./handlers/boundary.js";import{readActor as m,resolveAttribution as C}from"./attribution.js";const T={run:0,project:1,global:2},D=200,y=5;function W(a){const e=r=>Object.entries(r).filter(([,o])=>o>0).map(([o,c])=>`${o} ${c}`).join(" \xB7 ")||"none",t=r=>r.map(o=>`${"who"in o?o.who:o.run_id} \xD7${o.count}`).join(" \xB7 ")||"none",n=a.blocked.this_run.run_id===null?"- This run: (no run identity \u2014 export WYRM_RUN_ID or pass run_id)":`- This run (${a.blocked.this_run.run_id}): ${a.blocked.this_run.blocked} repeat(s) blocked`;return`\u{F115D} **Failure Analytics** (${a.project_id===null?"all projects":`project #${a.project_id}`})
1
+ import{sanitizeFtsQuery as I}from"./security.js";import{emitEvent as b,isLiveMemoryEnabled as A}from"./events.js";import{getActor as E,hasExplicitAttribution as j}from"./handlers/boundary.js";import{readActor as C,resolveAttribution as m}from"./attribution.js";import{normalizeContentSignature as D,containsFailedSignature as y}from"./content-signature.js";const g={run:0,project:1,global:2},M=200,U=5;function B(a){const e=r=>Object.entries(r).filter(([,o])=>o>0).map(([o,c])=>`${o} ${c}`).join(" \xB7 ")||"none",t=r=>r.map(o=>`${"who"in o?o.who:o.run_id} \xD7${o.count}`).join(" \xB7 ")||"none",n=a.blocked.this_run.run_id===null?"- This run: (no run identity \u2014 export WYRM_RUN_ID or pass run_id)":`- This run (${a.blocked.this_run.run_id}): ${a.blocked.this_run.blocked} repeat(s) blocked`;return`\u{F115D} **Failure Analytics** (${a.project_id===null?"all projects":`project #${a.project_id}`})
2
2
 
3
3
  **Recorded:** ${a.recorded.total} failure(s), ${a.recorded.unresolved} unresolved
4
4
  - By quarantine: ${e(a.recorded.by_quarantine_scope)}
@@ -12,7 +12,7 @@ import{sanitizeFtsQuery as I}from"./security.js";import{emitEvent as b,isLiveMem
12
12
  ${n}
13
13
  - By agent: ${t(a.blocked.by_agent)}
14
14
  - By run: ${t(a.blocked.by_run)}
15
- - Top blockers: ${a.blocked.top_blocked.map(r=>`#${r.failure_id} ${r.scope}:${r.target} \xD7${r.blocks}`).join(" \xB7 ")||"none"}`}function M(a,e){if(a==="exact")return 1;if(a==="target")return .95;const t=Math.max(0,-(e??0));return Number((.05+.85*(t/(t+2))).toFixed(4))}function h(a){return a.toLowerCase().replace(/\s+/g," ").trim()}function g(a){return h(a).slice(0,200)}class O{db;constructor(e){this.db=e}static signature(e,t,n){return`${e}:${g(t)}:${g(n).slice(0,80)}`}record(e){const t=O.signature(e.scope,e.target,e.description),n=e.project_id??null,r=E(),c=this.db.transaction(()=>{const i=this.db.prepare(`
15
+ - Top blockers: ${a.blocked.top_blocked.map(r=>`#${r.failure_id} ${r.scope}:${r.target} \xD7${r.blocks}`).join(" \xB7 ")||"none"}`}function k(a,e){if(a==="exact")return 1;if(a==="target")return .95;const t=Math.max(0,-(e??0));return Number((.05+.85*(t/(t+2))).toFixed(4))}function h(a){return a.toLowerCase().replace(/\s+/g," ").trim()}function T(a){return h(a).slice(0,200)}class O{db;constructor(e){this.db=e}static signature(e,t,n){return`${e}:${T(t)}:${T(n).slice(0,80)}`}record(e){const t=O.signature(e.scope,e.target,e.description),n=e.project_id??null,r=e.content&&D(e.content)||null,o=E(),s=this.db.transaction(()=>{const i=this.db.prepare(`
16
16
  SELECT * FROM failure_patterns
17
17
  WHERE signature = ? AND (project_id IS ? OR project_id = ?)
18
18
  `).get(t,n,n);if(i)return this.db.prepare(`
@@ -21,23 +21,29 @@ ${n}
21
21
  last_seen = datetime('now'),
22
22
  why_failed = COALESCE(?, why_failed),
23
23
  severity = ?,
24
+ content_sig = COALESCE(?, content_sig),
24
25
  resolved = 0
25
26
  WHERE id = ?
26
- `).run(e.why_failed??null,e.severity??i.severity,i.id),this.noteConfirmation(i.id,r),this.get(i.id);const s=e.quarantine_scope??(r.run_id!==null?"run":n===null?"global":"project"),d=this.db.prepare(`
27
+ `).run(e.why_failed??null,e.severity??i.severity,r,i.id),this.noteConfirmation(i.id,o),this.get(i.id);const u=e.quarantine_scope??(o.run_id!==null?"run":n===null?"global":"project"),l=this.db.prepare(`
27
28
  INSERT INTO failure_patterns
28
- (project_id, signature, scope, target, description, why_failed, severity, agent_id, run_id, quarantine_scope)
29
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
30
- `).run(n,t,e.scope,e.target,e.description,e.why_failed??null,e.severity??"medium",r.agent_id,r.run_id,s),u=this.get(d.lastInsertRowid);return this.noteConfirmation(u.id,r),u}).immediate();return b(this.db,{projectId:c.project_id??0,kind:"failure",refTable:"failure_patterns",refId:c.id}),c}get(e){return this.db.prepare("SELECT * FROM failure_patterns WHERE id = ?").get(e)??null}noteConfirmation(e,t){if(t.agent_id===null)return;this.db.prepare(`
29
+ (project_id, signature, scope, target, description, why_failed, severity, agent_id, run_id, quarantine_scope, content_sig)
30
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
31
+ `).run(n,t,e.scope,e.target,e.description,e.why_failed??null,e.severity??"medium",o.agent_id,o.run_id,u,r),d=this.get(l.lastInsertRowid);return this.noteConfirmation(d.id,o),d}).immediate();return b(this.db,{projectId:s.project_id??0,kind:"failure",refTable:"failure_patterns",refId:s.id}),s}contentMatch(e,t,n){const r=this.db.prepare(`
32
+ SELECT * FROM failure_patterns
33
+ WHERE content_sig IS NOT NULL AND scope = ? AND resolved = 0
34
+ AND (project_id IS ? OR project_id = ?)
35
+ ORDER BY occurrences DESC, last_seen DESC
36
+ `).all(t,n,n);for(const o of r)if(o.content_sig&&y(e,o.content_sig))return o;return null}get(e){return this.db.prepare("SELECT * FROM failure_patterns WHERE id = ?").get(e)??null}noteConfirmation(e,t){if(t.agent_id===null)return;this.db.prepare(`
31
37
  INSERT OR IGNORE INTO failure_confirmations (failure_id, agent_id, run_id)
32
38
  VALUES (?, ?, ?)
33
- `).run(e,t.agent_id,t.run_id);const n=this.get(e);if(!n||n.quarantine_scope!=="run")return;const{n:r}=this.db.prepare("SELECT COUNT(*) AS n FROM failure_confirmations WHERE failure_id = ?").get(e);r>=2&&this.applyPromotion(e,"project")}applyPromotion(e,t){const n=this.get(e);if(!n)return!1;const r=t==="project"&&n.project_id===null?"global":t;return T[r]<=T[n.quarantine_scope]?!1:(this.db.prepare("UPDATE failure_patterns SET quarantine_scope = ? WHERE id = ?").run(r,e),b(this.db,{projectId:n.project_id??0,kind:"failure",refTable:"failure_patterns",refId:e}),!0)}promote(e,t){if(!j(E()))return{row:this.get(e),authorized:!1,changed:!1};const n=this.applyPromotion(e,t);return{row:this.get(e),authorized:!0,changed:n}}sweepRunQuarantine(e){const t=Math.max(1,Math.floor(e?.runInactiveHours??24)),n=`-${t} hours`,r=Date.now()-t*36e5,o=A(),c=this.db.transaction(()=>{const i=this.db.prepare(`
39
+ `).run(e,t.agent_id,t.run_id);const n=this.get(e);if(!n||n.quarantine_scope!=="run")return;const{n:r}=this.db.prepare("SELECT COUNT(*) AS n FROM failure_confirmations WHERE failure_id = ?").get(e);r>=2&&this.applyPromotion(e,"project")}applyPromotion(e,t){const n=this.get(e);if(!n)return!1;const r=t==="project"&&n.project_id===null?"global":t;return g[r]<=g[n.quarantine_scope]?!1:(this.db.prepare("UPDATE failure_patterns SET quarantine_scope = ? WHERE id = ?").run(r,e),b(this.db,{projectId:n.project_id??0,kind:"failure",refTable:"failure_patterns",refId:e}),!0)}promote(e,t){if(!j(E()))return{row:this.get(e),authorized:!1,changed:!1};const n=this.applyPromotion(e,t);return{row:this.get(e),authorized:!0,changed:n}}sweepRunQuarantine(e){const t=Math.max(1,Math.floor(e?.runInactiveHours??24)),n=`-${t} hours`,r=Date.now()-t*36e5,o=A(),c=this.db.transaction(()=>{const s=this.db.prepare(`
34
40
  UPDATE failure_patterns
35
41
  SET resolved = 1,
36
42
  resolution_note = COALESCE(resolution_note || ' \xB7 ', '')
37
43
  || 'auto-expired by run-quarantine sweep: run ' || run_id || ' was abandoned'
38
44
  WHERE resolved = 0 AND quarantine_scope = 'run' AND run_id IS NOT NULL
39
45
  AND run_id IN (SELECT run_id FROM runs WHERE status = 'abandoned')
40
- `).run().changes,s=this.db.prepare(`
46
+ `).run().changes,i=this.db.prepare(`
41
47
  SELECT fp.id FROM failure_patterns fp
42
48
  WHERE fp.resolved = 0 AND fp.quarantine_scope = 'run' AND fp.run_id IS NOT NULL
43
49
  AND (
@@ -63,18 +69,18 @@ ${n}
63
69
  )
64
70
  )
65
71
  )
66
- `).all({cut:n,cutMs:r,ttl:o?1:0}).map(l=>l.id),d=this.db.prepare(`
72
+ `).all({cut:n,cutMs:r,ttl:o?1:0}).map(d=>d.id),u=this.db.prepare(`
67
73
  UPDATE failure_patterns
68
74
  SET quarantine_scope = CASE WHEN project_id IS NULL THEN 'global' ELSE 'project' END
69
75
  WHERE id = ?
70
- `);for(const l of s)d.run(l);const u=o?this.db.prepare(`
76
+ `);for(const d of i)u.run(d);const l=o?this.db.prepare(`
71
77
  UPDATE runs SET status = 'abandoned', updated_at = datetime('now')
72
78
  WHERE status = 'running' AND updated_at < datetime('now', @cut)
73
79
  AND NOT EXISTS (
74
80
  SELECT 1 FROM events e
75
81
  WHERE e.run_id = runs.run_id AND e.created_at >= @cutMs
76
82
  )
77
- `).run({cut:n,cutMs:r}).changes:0;return{promotedIds:s,expired:i,abandoned:u}})();for(const i of c.promotedIds){const s=this.get(i);b(this.db,{projectId:s?.project_id??0,kind:"failure",refTable:"failure_patterns",refId:i,agentId:null,runId:null})}return{promoted:c.promotedIds.length,expired:c.expired,runs_abandoned:c.abandoned,...o?{}:{degraded:"live memory off (WYRM_LIVE_MEMORY) \u2014 run-tagged events do not exist, so the run-inactivity TTL paths were skipped; only explicit run verdicts acted (completed/failed promote, abandoned expires)"}}}check(e,t,n,r,o){return this.query(e,t,n,r??null,o).map(({_match:c,_rank:i,...s})=>s)}checkVerdict(e,t,n,r,o){const i=this.query(e,t,n,r??null,o).map(s=>this.toVerdictMatch(s,s._match,s._rank));return{blocked:i.length>0,matches:i,recorded_by_agent:i[0]?.recorded_by_agent??null,run_id:i[0]?.run_id??null,confidence:i.reduce((s,d)=>Math.max(s,d.confidence),0)}}toVerdictMatch(e,t,n=null){const r=C(e);return{id:e.id,pattern:e.signature,scope:e.scope,quarantine_scope:e.quarantine_scope,target:e.target,description:e.description,why_failed:e.why_failed,severity:e.severity,occurrences:e.occurrences,last_seen:e.last_seen,recorded_by_agent:r.actor,run_id:r.run_id,match:t,confidence:M(t,n)}}targetIdentityMatches(e,t,n,r){const o=h(t),c=o.slice(0,200);if(c.length===0)return[];const i=r?.callerRunId!==void 0?r.callerRunId:E().run_id,s=`${e}:${c}:`,d=`${e}:${c};`;return this.db.prepare(`
83
+ `).run({cut:n,cutMs:r}).changes:0;return{promotedIds:i,expired:s,abandoned:l}})();for(const s of c.promotedIds){const i=this.get(s);b(this.db,{projectId:i?.project_id??0,kind:"failure",refTable:"failure_patterns",refId:s,agentId:null,runId:null})}return{promoted:c.promotedIds.length,expired:c.expired,runs_abandoned:c.abandoned,...o?{}:{degraded:"live memory off (WYRM_LIVE_MEMORY) \u2014 run-tagged events do not exist, so the run-inactivity TTL paths were skipped; only explicit run verdicts acted (completed/failed promote, abandoned expires)"}}}check(e,t,n,r,o){return this.query(e,t,n,r??null,o).map(({_match:c,_rank:s,...i})=>i)}checkVerdict(e,t,n,r,o){const s=this.query(e,t,n,r??null,o).map(i=>this.toVerdictMatch(i,i._match,i._rank));return{blocked:s.length>0,matches:s,recorded_by_agent:s[0]?.recorded_by_agent??null,run_id:s[0]?.run_id??null,confidence:s.reduce((i,u)=>Math.max(i,u.confidence),0)}}toVerdictMatch(e,t,n=null){const r=m(e);return{id:e.id,pattern:e.signature,scope:e.scope,quarantine_scope:e.quarantine_scope,target:e.target,description:e.description,why_failed:e.why_failed,severity:e.severity,occurrences:e.occurrences,last_seen:e.last_seen,recorded_by_agent:r.actor,run_id:r.run_id,match:t,confidence:k(t,n)}}targetIdentityMatches(e,t,n,r){const o=h(t),c=o.slice(0,200);if(c.length===0)return[];const s=r?.callerRunId!==void 0?r.callerRunId:E().run_id,i=`${e}:${c}:`,u=`${e}:${c};`;return this.db.prepare(`
78
84
  SELECT * FROM failure_patterns
79
85
  WHERE resolved = 0
80
86
  AND signature >= @lo AND signature < @hi
@@ -82,7 +88,7 @@ ${n}
82
88
  AND (quarantine_scope <> 'run' OR run_id = @run)
83
89
  ORDER BY occurrences DESC, last_seen DESC
84
90
  LIMIT @cap
85
- `).all({lo:s,hi:d,project:n??null,run:i,cap:D}).filter(l=>h(l.target)===o).slice(0,y)}recordBlock(e,t){if(!(!e.blocked||e.matches.length===0))try{const n=E();this.db.prepare(`
91
+ `).all({lo:i,hi:u,project:n??null,run:s,cap:M}).filter(d=>h(d.target)===o).slice(0,U)}recordBlock(e,t){if(!(!e.blocked||e.matches.length===0))try{const n=E();this.db.prepare(`
86
92
  INSERT INTO failure_blocks (failure_id, project_id, agent_id, run_id)
87
93
  VALUES (?, ?, ?, ?)
88
94
  `).run(e.matches[0].id,t??null,n.agent_id,n.run_id)}catch{}}pruneBlocks(e){const t=Math.max(1,Math.floor(e));try{return this.db.prepare("DELETE FROM failure_blocks WHERE blocked_at < datetime('now', @cut)").run({cut:`-${t} days`}).changes}catch{return 0}}failureStats(e){const t=e?.projectId??null,n=e?.callerRunId!==void 0?e.callerRunId:E().run_id,r={project:t},o=this.db.prepare(`
@@ -91,18 +97,18 @@ ${n}
91
97
  `).get(r),c={run:0,project:0,global:0};for(const _ of this.db.prepare(`
92
98
  SELECT quarantine_scope AS k, COUNT(*) AS n FROM failure_patterns
93
99
  WHERE (@project IS NULL OR project_id = @project) GROUP BY quarantine_scope
94
- `).all(r))c[_.k]=_.n;const i={file:0,symbol:0,command:0,prompt:0,edit:0};for(const _ of this.db.prepare(`
100
+ `).all(r))c[_.k]=_.n;const s={file:0,symbol:0,command:0,prompt:0,edit:0};for(const _ of this.db.prepare(`
95
101
  SELECT scope AS k, COUNT(*) AS n FROM failure_patterns
96
102
  WHERE (@project IS NULL OR project_id = @project) GROUP BY scope
97
- `).all(r))i[_.k]=_.n;const s=_=>_.map(N=>({who:m(N.agent_id),count:N.count})),d=s(this.db.prepare(`
103
+ `).all(r))s[_.k]=_.n;const i=_=>_.map(N=>({who:C(N.agent_id),count:N.count})),u=i(this.db.prepare(`
98
104
  SELECT agent_id, COUNT(*) AS count FROM failure_patterns
99
105
  WHERE (@project IS NULL OR project_id = @project)
100
106
  GROUP BY agent_id ORDER BY count DESC, agent_id ASC LIMIT 10
101
- `).all(r)),u=this.db.prepare(`
107
+ `).all(r)),l=this.db.prepare(`
102
108
  SELECT run_id, COUNT(*) AS count FROM failure_patterns
103
109
  WHERE run_id IS NOT NULL AND (@project IS NULL OR project_id = @project)
104
110
  GROUP BY run_id ORDER BY count DESC, run_id ASC LIMIT 10
105
- `).all(r),l=s(this.db.prepare(`
111
+ `).all(r),d=i(this.db.prepare(`
106
112
  SELECT agent_id, COUNT(*) AS count FROM failure_blocks
107
113
  WHERE (@project IS NULL OR project_id = @project)
108
114
  GROUP BY agent_id ORDER BY count DESC, agent_id ASC LIMIT 10
@@ -126,7 +132,7 @@ ${n}
126
132
  JOIN failure_patterns fp ON fp.id = fb.failure_id
127
133
  WHERE (@project IS NULL OR fb.project_id = @project)
128
134
  GROUP BY fb.failure_id ORDER BY blocks DESC, fb.failure_id ASC LIMIT 5
129
- `).all(r);return{view:"failures",project_id:t,recorded:{total:o.total,unresolved:o.unresolved,by_quarantine_scope:c,by_scope:i,by_agent:d,by_run:u},confirmations:{total:R.total,distinct_agents:R.distinct_agents},blocked:{total:p,by_agent:l,by_run:f,this_run:{run_id:n??null,blocked:S},top_blocked:L}}}query(e,t,n,r,o){const c=o?.callerRunId!==void 0?o.callerRunId:E().run_id,i=o?.runScope??"any",s={project:r,run:c,tier:i==="any"?null:i},d=O.signature(e,t,n),u=this.db.prepare(`
135
+ `).all(r);return{view:"failures",project_id:t,recorded:{total:o.total,unresolved:o.unresolved,by_quarantine_scope:c,by_scope:s,by_agent:u,by_run:l},confirmations:{total:R.total,distinct_agents:R.distinct_agents},blocked:{total:p,by_agent:d,by_run:f,this_run:{run_id:n??null,blocked:S},top_blocked:L}}}query(e,t,n,r,o){const c=o?.callerRunId!==void 0?o.callerRunId:E().run_id,s=o?.runScope??"any",i={project:r,run:c,tier:s==="any"?null:s},u=O.signature(e,t,n),l=this.db.prepare(`
130
136
  SELECT *, NULL AS _rank FROM failure_patterns
131
137
  WHERE resolved = 0 AND signature = @sig
132
138
  AND (project_id IS @project OR project_id = @project OR project_id IS NULL)
@@ -134,7 +140,7 @@ ${n}
134
140
  AND (@tier IS NULL OR quarantine_scope = @tier)
135
141
  ORDER BY occurrences DESC, last_seen DESC
136
142
  LIMIT 5
137
- `).all({...s,sig:d});if(u.length>0)return u.map(p=>({...p,_match:"exact",_rank:null}));const l=I(`${t} ${n}`.slice(0,100));if(!l)return[];const f=l.split(" ").filter(p=>/[\p{L}\p{N}]/u.test(p));if(f.length===0)return[];const R=f.map(p=>`"${p.replace(/"/g,"")}"`).join(" ");try{return this.db.prepare(`
143
+ `).all({...i,sig:u});if(l.length>0)return l.map(p=>({...p,_match:"exact",_rank:null}));const d=I(`${t} ${n}`.slice(0,100));if(!d)return[];const f=d.split(" ").filter(p=>/[\p{L}\p{N}]/u.test(p));if(f.length===0)return[];const R=f.map(p=>`"${p.replace(/"/g,"")}"`).join(" ");try{return this.db.prepare(`
138
144
  SELECT fp.*, bm25(failure_patterns_fts) AS _rank FROM failure_patterns fp
139
145
  JOIN failure_patterns_fts fts ON fts.rowid = fp.id
140
146
  WHERE failure_patterns_fts MATCH @q
@@ -145,11 +151,11 @@ ${n}
145
151
  AND (@tier IS NULL OR fp.quarantine_scope = @tier)
146
152
  ORDER BY fp.occurrences DESC, fp.last_seen DESC
147
153
  LIMIT 5
148
- `).all({...s,q:R,scope:e}).map(S=>({...S,_match:"fuzzy"}))}catch{return[]}}list(e,t=20){return e==null?this.db.prepare(`SELECT * FROM failure_patterns WHERE resolved = 0
154
+ `).all({...i,q:R,scope:e}).map(S=>({...S,_match:"fuzzy"}))}catch{return[]}}list(e,t=20){return e==null?this.db.prepare(`SELECT * FROM failure_patterns WHERE resolved = 0
149
155
  ORDER BY last_seen DESC LIMIT ?`).all(t):this.db.prepare(`SELECT * FROM failure_patterns
150
156
  WHERE resolved = 0 AND project_id = ?
151
157
  ORDER BY last_seen DESC LIMIT ?`).all(e,t)}resolve(e,t){return this.db.prepare(`
152
158
  UPDATE failure_patterns
153
159
  SET resolved = 1, resolution_note = ?
154
160
  WHERE id = ?
155
- `).run(t??null,e),this.get(e)}delete(e){return this.db.prepare("DELETE FROM failure_patterns WHERE id = ?").run(e).changes>0}}export{O as FailurePatterns,M as matchConfidence,h as normalizeIdentity,g as normalizeSignal,W as renderFailureStats};
161
+ `).run(t??null,e),this.get(e)}delete(e){return this.db.prepare("DELETE FROM failure_patterns WHERE id = ?").run(e).changes>0}}export{O as FailurePatterns,k as matchConfidence,h as normalizeIdentity,T as normalizeSignal,B as renderFailureStats};
@@ -1 +1 @@
1
- {"version":3,"file":"failure-patterns.js","sourceRoot":"","sources":["../src/failure-patterns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,g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AM,CAAC,EAAU;QACf,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CAC1B,2CAA2C,CAC5C,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACV,OAAO,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;IAC1B,CAAC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../src/handlers/capture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAiB3D,gDAAgD;AAChD,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,cAAc,EACd,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CACvF,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC,QAAQ,CAAC,cAAc,CAAC,CAymCpE,CAAC"}
1
+ {"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../src/handlers/capture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAiB3D,gDAAgD;AAChD,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,cAAc,EACd,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CACvF,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC,QAAQ,CAAC,cAAc,CAAC,CA+mCpE,CAAC"}
@@ -1,77 +1,77 @@
1
- import{join as N}from"path";import{TOOL_ANNOTATIONS as E}from"../tool-annotations.js";import{renderResult as q,withGlyph as I}from"../render.js";import{ValidationError as U,asEnum as H}from"../validate.js";import{daemonOr as A}from"../daemon-writer.js";import{classifyCapture as B}from"../capture.js";import{extractCandidates as M,candidateToArtifact as L,escapeLikePattern as D}from"../auto-capture.js";import{parseTrace as K,segmentsToText as J}from"../trace-harvest.js";import{getActor as Y,runWithActor as Q}from"./boundary.js";import{harvestProjects as X}from"../harvest.js";import{readFileSync as W,readdirSync as G,statSync as R}from"fs";import{join as O}from"path";import{homedir as V}from"os";import{readSpecDir as z,specTaskSignature as Z}from"../spec-kit.js";const ye=[{name:"wyrm_capture",description:"Use to save anything worth keeping - the single write funnel. Auto-classifies notes, decisions, and lessons into quest, ground truth, or memory; risky writes queue for wyrm_review. mode=direct (store a proven pattern or lesson learned so future agents reuse it), extract (pull memories from a conversation transcript or freeform text), trace (harvest a session JSONL / tool-call log into run-tagged review candidates), session (close out a work session into reusable knowledge), artifacts (harvest a repo's READMEs and recent commits into durable facts), import source=git|pr|rules, spec (turn a tasks.md into tracked work items), checklist. Keywords: remember this, jot down, write down, future reference.",inputSchema:{type:"object",properties:{content:{type:"string",description:"classify/rules"},project_id:{type:"number",description:"classify/import/spec"},tags:{type:"array",items:{type:"string"}},mode:{type:"string",enum:["auto","quest","truth","memory","classify","direct","extract","trace","session","artifacts","import","spec","checklist"],description:"quest|truth|memory force the type"},source:{type:"string",enum:["git","pr","rules"],description:"import"},projectPath:{type:"string",description:"non-classify"},kind:{type:"string",description:"direct"},problem:{type:"string",description:"direct"},validatedFix:{type:"string",description:"direct"},text:{type:"string",description:"extract"},sessionId:{type:"string",description:"session"},candidates:{type:"array",items:{type:"object"},description:"session"},dryRun:{type:"boolean",description:"artifacts"},commits:{type:"array",items:{type:"object"},description:"import git"},title:{type:"string",description:"import pr"},body:{type:"string",description:"import pr"},specDir:{type:"string",description:"spec"},problemType:{type:"string",description:"checklist"},whenToUse:{type:"string",description:"checklist"},steps:{type:"array",items:{type:"string"},description:"checklist"}},required:[]},outputSchema:{type:"object",properties:{status:{type:"string",enum:["captured","queued_for_review"]},type:{type:"string"},subtype:{type:"string"},confidence:{type:"number"},reasoning:{type:"string"},id:{type:"integer"},ref:{type:"string"},needs_review:{type:"boolean"},reason:{type:"string"},artifact_id:{type:"integer"},conflicts_with:{type:"array"},advisory_conflicts:{type:"array"}},required:["status"]},annotations:E.wyrm_capture,aliases:[],handler:async(v,{store:w,raw:j,memory:m,truths:_,cache:g})=>{const{content:c,project_id:f,tags:i,mode:u}=v;let a=B(c);u&&u!=="auto"&&(a={type:u,subtype:{quest:"quest",truth:"decision",memory:"pattern"}[u]??u,confidence:100,reasoning:`Mode override: ${u}`});const{type:d,subtype:p,confidence:s,reasoning:b}=a,e=f??null;let t=0,l="",o=!1,h;if(d==="quest"){if(e===null)return{content:[{type:"text",text:"Cannot capture quest without project_id. Please provide project_id."}],isError:!0};t=(await A("quest_add",e,{title:c.slice(0,200),description:"",priority:"medium",tags:i?.join(",")},()=>w.addQuest(e,c.slice(0,200),"","medium",i?.join(",")))).id,l="quest",g.invalidate("wyrm_all_quests"),g.invalidate("wyrm_stats")}else if(d==="truth"){if(e===null)return{content:[{type:"text",text:"Cannot capture truth without project_id. Please provide project_id."}],isError:!0};if(s>=80){const n=p??"other",$=_.getCurrent(e).filter(k=>k.category===n);if($.length>0){const k={kind:"pattern",problem:`Potential conflict with ${$.length} existing truth(s) in category "${n}"`,validatedFix:c,whyItWorked:"Pending review \u2014 possible supersession",tags:i??[],confidence:s/100,needsReview:1},S=await A("artifact_add",e,k,()=>m.add(e,k));return q({status:"queued_for_review",reason:"conflict_check",artifact_id:S.id,conflicts_with:$.map(y=>({id:y.id,content:y.value.slice(0,80)}))})}}if(u!=="truth"&&s<100){const n={kind:"pattern",problem:c,validatedFix:"",whyItWorked:"",tags:i??[],confidence:s/100,needsReview:1};t=(await A("artifact_add",e,n,()=>m.add(e,n))).id,l="mem",o=!0}else{const n={category:"decision",key:c.slice(0,60),value:c};t=(await A("truth_set",e,n,()=>_.set(e,n))).id,l="truth",g.invalidate("wyrm_truth_get"),g.invalidate("wyrm_context_build")}}else{if(e===null)return{content:[{type:"text",text:"Cannot capture memory without project_id. Please provide project_id."}],isError:!0};const n=s>=75,x={kind:p,problem:c,validatedFix:"",whyItWorked:"",tags:i??[],confidence:s/100,needsReview:n?0:1};if(t=(await A("artifact_add",e,x,()=>m.add(e,x))).id,l="mem",o=!n,p==="heuristic"&&s>=75&&e!==null)try{const k=c.replace(/['"*]/g," ").trim().split(/\s+/).slice(0,5).join(" "),S=j().prepare(`
1
+ import{join as N}from"path";import{TOOL_ANNOTATIONS as E}from"../tool-annotations.js";import{renderResult as q,withGlyph as I}from"../render.js";import{ValidationError as U,asEnum as H}from"../validate.js";import{daemonOr as A}from"../daemon-writer.js";import{classifyCapture as B}from"../capture.js";import{extractCandidates as M,candidateToArtifact as L,escapeLikePattern as D}from"../auto-capture.js";import{parseTrace as K,segmentsToText as J}from"../trace-harvest.js";import{getActor as Y,runWithActor as Q}from"./boundary.js";import{harvestProjects as X}from"../harvest.js";import{readFileSync as W,readdirSync as G,statSync as R}from"fs";import{join as O}from"path";import{homedir as V}from"os";import{readSpecDir as z,specTaskSignature as Z}from"../spec-kit.js";const ye=[{name:"wyrm_capture",description:"Use to save anything worth keeping - the single write funnel. Auto-classifies notes, decisions, and lessons into quest, ground truth, or memory; risky writes queue for wyrm_review. mode=direct (store a proven pattern or lesson learned so future agents reuse it), extract (pull memories from a conversation transcript or freeform text), trace (harvest a session JSONL / tool-call log into run-tagged review candidates), session (close out a work session into reusable knowledge), artifacts (harvest a repo's READMEs and recent commits into durable facts), import source=git|pr|rules, spec (turn a tasks.md into tracked work items), checklist. Keywords: remember this, jot down, write down, future reference.",inputSchema:{type:"object",properties:{content:{type:"string",description:"classify/rules"},project_id:{type:"number",description:"classify/import/spec"},tags:{type:"array",items:{type:"string"}},mode:{type:"string",enum:["auto","quest","truth","memory","classify","direct","extract","trace","session","artifacts","import","spec","checklist"],description:"quest|truth|memory force the type"},source:{type:"string",enum:["git","pr","rules"],description:"import"},projectPath:{type:"string",description:"non-classify"},kind:{type:"string",description:"direct"},problem:{type:"string",description:"direct"},validatedFix:{type:"string",description:"direct"},text:{type:"string",description:"extract"},sessionId:{type:"string",description:"session"},candidates:{type:"array",items:{type:"object"},description:"session"},dryRun:{type:"boolean",description:"artifacts"},commits:{type:"array",items:{type:"object"},description:"import git"},title:{type:"string",description:"import pr"},body:{type:"string",description:"import pr"},specDir:{type:"string",description:"spec"},problemType:{type:"string",description:"checklist"},whenToUse:{type:"string",description:"checklist"},steps:{type:"array",items:{type:"string"},description:"checklist"}},required:[]},outputSchema:{type:"object",properties:{status:{type:"string",enum:["captured","queued_for_review"]},type:{type:"string"},subtype:{type:"string"},confidence:{type:"number"},reasoning:{type:"string"},id:{type:"integer"},ref:{type:"string"},needs_review:{type:"boolean"},reason:{type:"string"},artifact_id:{type:"integer"},conflicts_with:{type:"array"},advisory_conflicts:{type:"array"}},required:["status"]},annotations:E.wyrm_capture,aliases:[],handler:async(j,{store:v,raw:b,memory:u,truths:g,cache:f})=>{const{content:a,project_id:m,projectPath:o,tags:y,mode:i}=j;let d=B(a);i&&i!=="auto"&&(d={type:i,subtype:{quest:"quest",truth:"decision",memory:"pattern"}[i]??i,confidence:100,reasoning:`Mode override: ${i}`});const{type:p,subtype:c,confidence:h,reasoning:r}=d,e=m??(o?v.getProject(o)?.id??null:null);let n=0,s="",_=!1,t;if(p==="quest"){if(e===null)return{content:[{type:"text",text:"Cannot capture quest without project_id. Please provide project_id."}],isError:!0};n=(await A("quest_add",e,{title:a.slice(0,200),description:"",priority:"medium",tags:y?.join(",")},()=>v.addQuest(e,a.slice(0,200),"","medium",y?.join(",")))).id,s="quest",f.invalidate("wyrm_all_quests"),f.invalidate("wyrm_stats")}else if(p==="truth"){if(e===null)return{content:[{type:"text",text:"Cannot capture truth without project_id. Please provide project_id."}],isError:!0};if(h>=80){const w=c??"other",S=g.getCurrent(e).filter(x=>x.category===w);if(S.length>0){const x={kind:"pattern",problem:`Potential conflict with ${S.length} existing truth(s) in category "${w}"`,validatedFix:a,whyItWorked:"Pending review \u2014 possible supersession",tags:y??[],confidence:h/100,needsReview:1},l=await A("artifact_add",e,x,()=>u.add(e,x));return q({status:"queued_for_review",reason:"conflict_check",artifact_id:l.id,conflicts_with:S.map(k=>({id:k.id,content:k.value.slice(0,80)}))})}}if(i!=="truth"&&h<100){const w={kind:"pattern",problem:a,validatedFix:"",whyItWorked:"",tags:y??[],confidence:h/100,needsReview:1};n=(await A("artifact_add",e,w,()=>u.add(e,w))).id,s="mem",_=!0}else{const w={category:"decision",key:a.slice(0,60),value:a};n=(await A("truth_set",e,w,()=>g.set(e,w))).id,s="truth",f.invalidate("wyrm_truth_get"),f.invalidate("wyrm_context_build")}}else{if(e===null)return{content:[{type:"text",text:"Cannot capture memory without project_id. Please provide project_id."}],isError:!0};const w=h>=75,P={kind:c,problem:a,validatedFix:"",whyItWorked:"",tags:y??[],confidence:h/100,needsReview:w?0:1};if(n=(await A("artifact_add",e,P,()=>u.add(e,P))).id,s="mem",_=!w,c==="heuristic"&&h>=75&&e!==null)try{const x=a.replace(/['"*]/g," ").trim().split(/\s+/).slice(0,5).join(" "),l=b().prepare(`
2
2
  SELECT a.id, a.problem FROM memory_artifacts a
3
3
  JOIN memory_artifacts_fts fts ON a.id = fts.rowid
4
4
  WHERE fts MATCH ? AND a.project_id = ? AND a.kind = 'heuristic' AND a.needs_review = 0
5
5
  LIMIT 3
6
- `).all(k,e);S.length>0&&(h=S.map(y=>({id:y.id,content:y.problem.slice(0,80)})))}catch{}}const r={status:"captured",type:d,subtype:p,confidence:s,reasoning:b,id:t,ref:`${l}:${t}`,needs_review:o,...h&&h.length>0?{advisory_conflicts:h}:{}};return q(r,(n,x)=>{let $=`Captured as ${n.type}: ${n.subtype}
7
- Confidence: ${n.confidence}% | ${n.reasoning}
8
- ID: ${n.ref}`;n.needs_review&&($+=`
9
- `+I(x.warn,"Stored for review -- run `wyrm_review` to activate"));const k=n.advisory_conflicts;return k&&k.length>0&&($+=`
10
-
11
- `+I(x.warn,`Advisory: ${k.length} similar heuristic(s) found:`)+`
12
- `+k.map(S=>` ${x.bullet} [${S.id}] ${S.content}`).join(`
13
- `)),$})}},{name:"wyrm_remember",description:"Store a distilled knowledge artifact \u2014 proven patterns, lessons learned, anti-patterns, and reasoning traces. These are recalled automatically by wyrm_context_build to help AI models apply past knowledge to new tasks. Example: wyrm_remember({ projectPath: '/home/user/api', kind: 'anti_pattern', problem: 'Jest suite hung after adding the SSE server', validatedFix: 'close() the server in afterAll \u2014 its keep-alive timer held the event loop open', whyItWorked: 'open handles block jest exit', outcome: 'positive', tags: ['jest', 'sse'] })",inputSchema:{type:"object",properties:{projectPath:{type:"string",description:"Project this knowledge belongs to"},kind:{type:"string",enum:["reasoning_trace","lesson","pattern","anti_pattern","heuristic"],description:"reasoning_trace: a solved problem with steps; lesson: a general insight; pattern: a proven approach; anti_pattern: what NOT to do; heuristic: a rule of thumb"},problem:{type:"string",description:"What was being solved or observed (be specific and searchable)"},constraints:{type:"string",description:"What conditions or constraints applied"},validatedFix:{type:"string",description:"What actually worked \u2014 the validated solution or approach"},whyItWorked:{type:"string",description:"The insight behind WHY this worked (key for transfer learning)"},outcome:{type:"string",enum:["positive","negative","neutral"],description:"Was this approach successful?"},tags:{type:"array",items:{type:"string"},description:"Searchable tags (e.g. ['auth', 'rate-limit', 'typescript'])"},confidence:{type:"number",description:"Confidence level 0.0\u20131.0 (default: 1.0)"},sourceSessionId:{type:"number",description:"Session ID where this was discovered (optional)"}},required:["projectPath","kind","problem"]},outputSchema:{type:"object",properties:{id:{type:"integer"},kind:{type:"string",enum:["reasoning_trace","lesson","pattern","anti_pattern","heuristic"]},problem:{type:"string"},validated_fix:{type:["string","null"]},why_it_worked:{type:["string","null"]},confidence:{type:"number"},tags:{type:["string","null"]}},required:["id","kind","problem","validated_fix","why_it_worked","confidence","tags"]},annotations:E.wyrm_remember,aliases:[],handler:async(v,{store:w,memory:j})=>{const{projectPath:m,kind:_,problem:g,constraints:c,validatedFix:f,whyItWorked:i,outcome:u,tags:a,confidence:d,sourceSessionId:p}=v,s=H("kind",_,["reasoning_trace","lesson","pattern","anti_pattern","heuristic"]);if(s===void 0)throw new U("kind","is required");const b=w.getProject(m);if(!b)return{content:[{type:"text",text:`Project not found: ${m}`}],isError:!0};const e={kind:s,problem:g,constraints:c,validatedFix:f,whyItWorked:i,outcome:u,tags:a,confidence:d,sourceSessionId:p},t=await A("artifact_add",b.id,e,()=>j.add(b.id,e)),l={id:t.id,kind:t.kind,problem:t.problem,validated_fix:t.validated_fix??null,why_it_worked:t.why_it_worked??null,confidence:t.confidence,tags:t.tags??null};return q(l,(o,h)=>{let r=I(h.brand,"**Memory Stored**")+`
14
-
15
- `;return r+=`${h.bullet} **Kind:** ${o.kind}
16
- `,r+=`${h.bullet} **ID:** ${o.id}
17
- `,r+=`${h.bullet} **Problem:** ${o.problem}
18
- `,o.validated_fix&&(r+=`${h.bullet} **Solution:** ${o.validated_fix}
19
- `),o.why_it_worked&&(r+=`${h.bullet} **Why it worked:** ${o.why_it_worked}
20
- `),r+=`${h.bullet} **Confidence:** ${(o.confidence*100).toFixed(0)}%
21
- `,o.tags&&(r+=`${h.bullet} **Tags:** ${o.tags}
22
- `),r+="\n_Use `wyrm_recall` to retrieve similar memories, or `wyrm_context_build` to assemble a task brief._",r})}},{name:"wyrm_auto_capture",description:"Auto-extract durable memories from freeform text (a session transcript, notes, a chat) into the REVIEW QUEUE. A LOCAL extractor \u2014 a configurable Ollama model (WYRM_EXTRACT_MODEL / the `model` arg) if set, else a deterministic heuristic \u2014 pulls out truths, failures, decisions, patterns, and lessons as needs_review candidates; approve/reject with wyrm_review (nothing auto-trusted). Closes the 'just talk, it remembers' gap without a cloud LLM. Deduped + idempotent. Example: wyrm_auto_capture({ projectPath: '/home/user/api', text: 'Deploy failed twice because wrangler.toml pointed at the old KV id; switched to the new binding and decided to pin binding names in CI.' })",inputSchema:{type:"object",properties:{projectPath:{type:"string",description:"Project to file the extracted candidates under"},text:{type:"string",description:"Freeform text to extract durable memories from"},model:{type:"string",description:"Optional Ollama model for extraction (overrides WYRM_EXTRACT_MODEL); omit for deterministic extraction"}},required:["projectPath","text"]},outputSchema:{type:"object",properties:{method:{type:"string"},model:{type:["string","null"]},added:{type:"integer"},skipped:{type:"integer"},candidates:{type:"array",items:{type:"object",properties:{kind:{type:"string"},text:{type:"string"}},required:["kind","text"]}}},required:["method","model","added","skipped","candidates"]},annotations:E.wyrm_auto_capture,aliases:[],handler:async(v,{store:w,raw:j,memory:m,cache:_})=>{const{projectPath:g,text:c,model:f}=v,i=w.getProject(g);if(!i)return{content:[{type:"text",text:`Project not found: ${g}`}],isError:!0};if(!c||c.trim().length<20)return{content:[{type:"text",text:"Provide at least ~20 chars of text to extract from."}],isError:!0};const{candidates:u,method:a,model:d}=await M(c,{model:f}),p=j();let s=0,b=0;for(const t of u){const l=L(t),o=l.tags[l.tags.length-1];if(p.prepare("SELECT 1 FROM memory_artifacts WHERE project_id = ? AND tags LIKE ? ESCAPE '\\' LIMIT 1").get(i.id,"%"+D(o)+"%")){b++;continue}m.add(i.id,{kind:l.kind,problem:l.problem,tags:l.tags,confidence:l.confidence,needsReview:1,createdBy:"auto-extract"}),s++}s>0&&_.invalidate();const e={method:a,model:d??null,added:s,skipped:b,candidates:u.slice(0,8).map(t=>({kind:t.kind,text:t.text.slice(0,80)}))};return q(e,(t,l)=>{const o=t.candidates.map(h=>` ${l.bullet} [${h.kind}] ${h.text}`).join(`
23
- `);return I(l.brand,`Auto-capture (${t.method}${t.model?` - ${t.model}`:""}) -- ${t.added} candidate(s) -> review queue, ${t.skipped} already present.`)+`
24
- ${o}
25
-
26
- Approve/reject with wyrm_review.`})}},{name:"wyrm_capture_trace",description:"Harvest a harness's working trace into run-tagged review-queue candidates \u2014 OFFLINE. Ingests a Claude Code session transcript (JSONL), a ~/.dragon/traces file/dir, or WYRM_TRACE_TOOL_CALLS event output. The SAME local extractor as auto-capture (Ollama WYRM_EXTRACT_MODEL if set, else deterministic \u2014 never a cloud LLM) pulls durable truths/failures/decisions/patterns/lessons; secrets (API keys, tokens, passwords) are REDACTED before anything is stored; candidates land needs_review=1 stamped with the run_id (arg or ambient envelope). Approve/reject with wyrm_review; deduped + idempotent. Pass `trace` (inline text) OR `path` (a trace file or the ~/.dragon/traces dir). Reached via wyrm_capture({ mode: 'trace' }).",inputSchema:{type:"object",properties:{projectPath:{type:"string",description:"Project to file the candidates under"},trace:{type:"string",description:"Inline trace text (JSONL transcript / dragon records / tool-call events)"},path:{type:"string",description:"Path to a trace file, or the ~/.dragon/traces directory (newest file is read); omit ~ for absolute"},format:{type:"string",enum:["auto","claude-jsonl","dragon","tool-calls"],description:"Trace format (default auto-detect)"},run_id:{type:"string",description:"Tag candidates with this run (default: ambient envelope run_id)"},model:{type:"string",description:"Optional Ollama model for extraction (overrides WYRM_EXTRACT_MODEL); omit for deterministic"}},required:["projectPath"]},outputSchema:{type:"object",properties:{method:{type:"string"},model:{type:["string","null"]},format:{type:"string"},source:{type:"string"},run_id:{type:["string","null"]},segments:{type:"integer"},added:{type:"integer"},skipped:{type:"integer"},candidates:{type:"array",items:{type:"object",properties:{kind:{type:"string"},text:{type:"string"}},required:["kind","text"]}}},required:["method","model","format","source","run_id","segments","added","skipped","candidates"]},annotations:E.wyrm_capture_trace,aliases:[],handler:async(v,{store:w,raw:j,memory:m,cache:_})=>{const{projectPath:g,trace:c,path:f,format:i,run_id:u,model:a}=v,d=w.getProject(g);if(!d)return{content:[{type:"text",text:`Project not found: ${g}`}],isError:!0};const p=Y(),s=typeof u=="string"&&u.trim()?u.trim().slice(0,64):p.run_id;let b="",e="inline";if(typeof c=="string"&&c.trim())b=c,e="inline";else if(typeof f=="string"&&f.trim()){let y=f.trim();(y==="~"||y.startsWith("~/"))&&(y=O(V(),y.slice(1)));try{if(R(y).isDirectory()){const T=G(y).map(C=>O(y,C)).filter(C=>{try{return R(C).isFile()}catch{return!1}}).sort((C,F)=>R(F).mtimeMs-R(C).mtimeMs);if(T.length===0)return{content:[{type:"text",text:`No trace files in directory: ${y}`}],isError:!0};b=W(T[0],"utf-8"),e=T[0]}else b=W(y,"utf-8"),e=y}catch(P){return{content:[{type:"text",text:`Could not read trace path "${y}": ${P.message}`}],isError:!0}}}else return{content:[{type:"text",text:"Provide a `trace` (inline text) or a `path` (trace file or ~/.dragon/traces dir)."}],isError:!0};const{segments:t,format:l}=K(b,i??"auto"),o=J(t);if(o.trim().length<20){const y={method:"deterministic",model:null,format:l,source:e,run_id:s,segments:t.length,added:0,skipped:0,candidates:[]};return q(y,(P,T)=>I(T.brand,`Trace harvest (${P.format}) -- no durable content extracted from ${P.segments} segment(s).`))}const{candidates:h,method:r,model:n}=await M(o,{model:a}),x=j();let $=0,k=0;for(const y of h){const P=L(y),T=P.tags[P.tags.length-1];if(x.prepare("SELECT 1 FROM memory_artifacts WHERE project_id = ? AND tags LIKE ? ESCAPE '\\' LIMIT 1").get(d.id,"%"+D(T)+"%")){k++;continue}const C=s?[...P.tags,"trace",`run:${s}`]:[...P.tags,"trace"];Q({agent_id:p.agent_id,run_id:s,source:s?"param":p.source},()=>m.add(d.id,{kind:P.kind,problem:P.problem,tags:C,confidence:P.confidence,needsReview:1,createdBy:"trace-harvest"})),$++}$>0&&_.invalidate();const S={method:r,model:n??null,format:l,source:e,run_id:s,segments:t.length,added:$,skipped:k,candidates:h.slice(0,8).map(y=>({kind:y.kind,text:y.text.slice(0,80)}))};return q(S,(y,P)=>{const T=y.candidates.map(C=>` ${P.bullet} [${C.kind}] ${C.text}`).join(`
27
- `);return I(P.brand,`Trace harvest (${y.format}, ${y.method}${y.model?` - ${y.model}`:""}) -- ${y.segments} segment(s) -> ${y.added} candidate(s) to review queue, ${y.skipped} already present${y.run_id?` [run:${y.run_id}]`:""}.`)+(T?`
6
+ `).all(x,e);l.length>0&&(t=l.map(k=>({id:k.id,content:k.problem.slice(0,80)})))}catch{}}const $={status:"captured",type:p,subtype:c,confidence:h,reasoning:r,id:n,ref:`${s}:${n}`,needs_review:_,...t&&t.length>0?{advisory_conflicts:t}:{}};return q($,(w,P)=>{let S=`Captured as ${w.type}: ${w.subtype}
7
+ Confidence: ${w.confidence}% | ${w.reasoning}
8
+ ID: ${w.ref}`;w.needs_review&&(S+=`
9
+ `+I(P.warn,"Stored for review -- run `wyrm_review` to activate"));const x=w.advisory_conflicts;return x&&x.length>0&&(S+=`
10
+
11
+ `+I(P.warn,`Advisory: ${x.length} similar heuristic(s) found:`)+`
12
+ `+x.map(l=>` ${P.bullet} [${l.id}] ${l.content}`).join(`
13
+ `)),S})}},{name:"wyrm_remember",description:"Store a distilled knowledge artifact \u2014 proven patterns, lessons learned, anti-patterns, and reasoning traces. These are recalled automatically by wyrm_context_build to help AI models apply past knowledge to new tasks. Example: wyrm_remember({ projectPath: '/home/user/api', kind: 'anti_pattern', problem: 'Jest suite hung after adding the SSE server', validatedFix: 'close() the server in afterAll \u2014 its keep-alive timer held the event loop open', whyItWorked: 'open handles block jest exit', outcome: 'positive', tags: ['jest', 'sse'] })",inputSchema:{type:"object",properties:{projectPath:{type:"string",description:"Project this knowledge belongs to"},kind:{type:"string",enum:["reasoning_trace","lesson","pattern","anti_pattern","heuristic"],description:"reasoning_trace: a solved problem with steps; lesson: a general insight; pattern: a proven approach; anti_pattern: what NOT to do; heuristic: a rule of thumb"},problem:{type:"string",description:"What was being solved or observed (be specific and searchable)"},constraints:{type:"string",description:"What conditions or constraints applied"},validatedFix:{type:"string",description:"What actually worked \u2014 the validated solution or approach"},whyItWorked:{type:"string",description:"The insight behind WHY this worked (key for transfer learning)"},outcome:{type:"string",enum:["positive","negative","neutral"],description:"Was this approach successful?"},tags:{type:"array",items:{type:"string"},description:"Searchable tags (e.g. ['auth', 'rate-limit', 'typescript'])"},confidence:{type:"number",description:"Confidence level 0.0\u20131.0 (default: 1.0)"},sourceSessionId:{type:"number",description:"Session ID where this was discovered (optional)"}},required:["projectPath","kind","problem"]},outputSchema:{type:"object",properties:{id:{type:"integer"},kind:{type:"string",enum:["reasoning_trace","lesson","pattern","anti_pattern","heuristic"]},problem:{type:"string"},validated_fix:{type:["string","null"]},why_it_worked:{type:["string","null"]},confidence:{type:"number"},tags:{type:["string","null"]}},required:["id","kind","problem","validated_fix","why_it_worked","confidence","tags"]},annotations:E.wyrm_remember,aliases:[],handler:async(j,{store:v,memory:b})=>{const{projectPath:u,kind:g,problem:f,constraints:a,validatedFix:m,whyItWorked:o,outcome:y,tags:i,confidence:d,sourceSessionId:p}=j,c=H("kind",g,["reasoning_trace","lesson","pattern","anti_pattern","heuristic"]);if(c===void 0)throw new U("kind","is required");const h=v.getProject(u);if(!h)return{content:[{type:"text",text:`Project not found: ${u}`}],isError:!0};const r={kind:c,problem:f,constraints:a,validatedFix:m,whyItWorked:o,outcome:y,tags:i,confidence:d,sourceSessionId:p},e=await A("artifact_add",h.id,r,()=>b.add(h.id,r)),n={id:e.id,kind:e.kind,problem:e.problem,validated_fix:e.validated_fix??null,why_it_worked:e.why_it_worked??null,confidence:e.confidence,tags:e.tags??null};return q(n,(s,_)=>{let t=I(_.brand,"**Memory Stored**")+`
14
+
15
+ `;return t+=`${_.bullet} **Kind:** ${s.kind}
16
+ `,t+=`${_.bullet} **ID:** ${s.id}
17
+ `,t+=`${_.bullet} **Problem:** ${s.problem}
18
+ `,s.validated_fix&&(t+=`${_.bullet} **Solution:** ${s.validated_fix}
19
+ `),s.why_it_worked&&(t+=`${_.bullet} **Why it worked:** ${s.why_it_worked}
20
+ `),t+=`${_.bullet} **Confidence:** ${(s.confidence*100).toFixed(0)}%
21
+ `,s.tags&&(t+=`${_.bullet} **Tags:** ${s.tags}
22
+ `),t+="\n_Use `wyrm_recall` to retrieve similar memories, or `wyrm_context_build` to assemble a task brief._",t})}},{name:"wyrm_auto_capture",description:"Auto-extract durable memories from freeform text (a session transcript, notes, a chat) into the REVIEW QUEUE. A LOCAL extractor \u2014 a configurable Ollama model (WYRM_EXTRACT_MODEL / the `model` arg) if set, else a deterministic heuristic \u2014 pulls out truths, failures, decisions, patterns, and lessons as needs_review candidates; approve/reject with wyrm_review (nothing auto-trusted). Closes the 'just talk, it remembers' gap without a cloud LLM. Deduped + idempotent. Example: wyrm_auto_capture({ projectPath: '/home/user/api', text: 'Deploy failed twice because wrangler.toml pointed at the old KV id; switched to the new binding and decided to pin binding names in CI.' })",inputSchema:{type:"object",properties:{projectPath:{type:"string",description:"Project to file the extracted candidates under"},text:{type:"string",description:"Freeform text to extract durable memories from"},model:{type:"string",description:"Optional Ollama model for extraction (overrides WYRM_EXTRACT_MODEL); omit for deterministic extraction"}},required:["projectPath","text"]},outputSchema:{type:"object",properties:{method:{type:"string"},model:{type:["string","null"]},added:{type:"integer"},skipped:{type:"integer"},candidates:{type:"array",items:{type:"object",properties:{kind:{type:"string"},text:{type:"string"}},required:["kind","text"]}}},required:["method","model","added","skipped","candidates"]},annotations:E.wyrm_auto_capture,aliases:[],handler:async(j,{store:v,raw:b,memory:u,cache:g})=>{const{projectPath:f,text:a,model:m}=j,o=v.getProject(f);if(!o)return{content:[{type:"text",text:`Project not found: ${f}`}],isError:!0};if(!a||a.trim().length<20)return{content:[{type:"text",text:"Provide at least ~20 chars of text to extract from."}],isError:!0};const{candidates:y,method:i,model:d}=await M(a,{model:m}),p=b();let c=0,h=0;for(const e of y){const n=L(e),s=n.tags[n.tags.length-1];if(p.prepare("SELECT 1 FROM memory_artifacts WHERE project_id = ? AND tags LIKE ? ESCAPE '\\' LIMIT 1").get(o.id,"%"+D(s)+"%")){h++;continue}u.add(o.id,{kind:n.kind,problem:n.problem,tags:n.tags,confidence:n.confidence,needsReview:1,createdBy:"auto-extract"}),c++}c>0&&g.invalidate();const r={method:i,model:d??null,added:c,skipped:h,candidates:y.slice(0,8).map(e=>({kind:e.kind,text:e.text.slice(0,80)}))};return q(r,(e,n)=>{const s=e.candidates.map(_=>` ${n.bullet} [${_.kind}] ${_.text}`).join(`
23
+ `);return I(n.brand,`Auto-capture (${e.method}${e.model?` - ${e.model}`:""}) -- ${e.added} candidate(s) -> review queue, ${e.skipped} already present.`)+`
24
+ ${s}
25
+
26
+ Approve/reject with wyrm_review.`})}},{name:"wyrm_capture_trace",description:"Harvest a harness's working trace into run-tagged review-queue candidates \u2014 OFFLINE. Ingests a Claude Code session transcript (JSONL), a ~/.dragon/traces file/dir, or WYRM_TRACE_TOOL_CALLS event output. The SAME local extractor as auto-capture (Ollama WYRM_EXTRACT_MODEL if set, else deterministic \u2014 never a cloud LLM) pulls durable truths/failures/decisions/patterns/lessons; secrets (API keys, tokens, passwords) are REDACTED before anything is stored; candidates land needs_review=1 stamped with the run_id (arg or ambient envelope). Approve/reject with wyrm_review; deduped + idempotent. Pass `trace` (inline text) OR `path` (a trace file or the ~/.dragon/traces dir). Reached via wyrm_capture({ mode: 'trace' }).",inputSchema:{type:"object",properties:{projectPath:{type:"string",description:"Project to file the candidates under"},trace:{type:"string",description:"Inline trace text (JSONL transcript / dragon records / tool-call events)"},path:{type:"string",description:"Path to a trace file, or the ~/.dragon/traces directory (newest file is read); omit ~ for absolute"},format:{type:"string",enum:["auto","claude-jsonl","dragon","tool-calls"],description:"Trace format (default auto-detect)"},run_id:{type:"string",description:"Tag candidates with this run (default: ambient envelope run_id)"},model:{type:"string",description:"Optional Ollama model for extraction (overrides WYRM_EXTRACT_MODEL); omit for deterministic"}},required:["projectPath"]},outputSchema:{type:"object",properties:{method:{type:"string"},model:{type:["string","null"]},format:{type:"string"},source:{type:"string"},run_id:{type:["string","null"]},segments:{type:"integer"},added:{type:"integer"},skipped:{type:"integer"},candidates:{type:"array",items:{type:"object",properties:{kind:{type:"string"},text:{type:"string"}},required:["kind","text"]}}},required:["method","model","format","source","run_id","segments","added","skipped","candidates"]},annotations:E.wyrm_capture_trace,aliases:[],handler:async(j,{store:v,raw:b,memory:u,cache:g})=>{const{projectPath:f,trace:a,path:m,format:o,run_id:y,model:i}=j,d=v.getProject(f);if(!d)return{content:[{type:"text",text:`Project not found: ${f}`}],isError:!0};const p=Y(),c=typeof y=="string"&&y.trim()?y.trim().slice(0,64):p.run_id;let h="",r="inline";if(typeof a=="string"&&a.trim())h=a,r="inline";else if(typeof m=="string"&&m.trim()){let l=m.trim();(l==="~"||l.startsWith("~/"))&&(l=O(V(),l.slice(1)));try{if(R(l).isDirectory()){const T=G(l).map(C=>O(l,C)).filter(C=>{try{return R(C).isFile()}catch{return!1}}).sort((C,F)=>R(F).mtimeMs-R(C).mtimeMs);if(T.length===0)return{content:[{type:"text",text:`No trace files in directory: ${l}`}],isError:!0};h=W(T[0],"utf-8"),r=T[0]}else h=W(l,"utf-8"),r=l}catch(k){return{content:[{type:"text",text:`Could not read trace path "${l}": ${k.message}`}],isError:!0}}}else return{content:[{type:"text",text:"Provide a `trace` (inline text) or a `path` (trace file or ~/.dragon/traces dir)."}],isError:!0};const{segments:e,format:n}=K(h,o??"auto"),s=J(e);if(s.trim().length<20){const l={method:"deterministic",model:null,format:n,source:r,run_id:c,segments:e.length,added:0,skipped:0,candidates:[]};return q(l,(k,T)=>I(T.brand,`Trace harvest (${k.format}) -- no durable content extracted from ${k.segments} segment(s).`))}const{candidates:_,method:t,model:$}=await M(s,{model:i}),w=b();let P=0,S=0;for(const l of _){const k=L(l),T=k.tags[k.tags.length-1];if(w.prepare("SELECT 1 FROM memory_artifacts WHERE project_id = ? AND tags LIKE ? ESCAPE '\\' LIMIT 1").get(d.id,"%"+D(T)+"%")){S++;continue}const C=c?[...k.tags,"trace",`run:${c}`]:[...k.tags,"trace"];Q({agent_id:p.agent_id,run_id:c,source:c?"param":p.source},()=>u.add(d.id,{kind:k.kind,problem:k.problem,tags:C,confidence:k.confidence,needsReview:1,createdBy:"trace-harvest"})),P++}P>0&&g.invalidate();const x={method:t,model:$??null,format:n,source:r,run_id:c,segments:e.length,added:P,skipped:S,candidates:_.slice(0,8).map(l=>({kind:l.kind,text:l.text.slice(0,80)}))};return q(x,(l,k)=>{const T=l.candidates.map(C=>` ${k.bullet} [${C.kind}] ${C.text}`).join(`
27
+ `);return I(k.brand,`Trace harvest (${l.format}, ${l.method}${l.model?` - ${l.model}`:""}) -- ${l.segments} segment(s) -> ${l.added} candidate(s) to review queue, ${l.skipped} already present${l.run_id?` [run:${l.run_id}]`:""}.`)+(T?`
28
28
  ${T}`:"")+`
29
29
 
30
- Approve/reject with wyrm_review.`})}},{name:"wyrm_distill",description:"Distill a work session into candidate memory artifacts for review. Parses the session's objectives, decisions, and outcomes into structured artifacts (lessons, patterns, anti-patterns) and queues them for approval via wyrm_review. Use at session end to extract institutional knowledge.",inputSchema:{type:"object",properties:{projectPath:{type:"string",description:"Project root path"},sessionId:{type:"string",description:"Session ID to distill"},candidates:{type:"array",description:"Pre-parsed candidate artifacts to store for review",items:{type:"object",properties:{kind:{type:"string",enum:["lesson","pattern","anti_pattern","heuristic","reasoning_trace"]},title:{type:"string"},content:{type:"string"},tags:{type:"array",items:{type:"string"}},confidence:{type:"number"}},required:["kind","title","content"]}}},required:["projectPath","candidates"]},outputSchema:{type:"object",properties:{count:{type:"integer"},artifacts:{type:"array",items:{type:"object",properties:{id:{type:"integer"},kind:{type:"string"},title:{type:"string"}},required:["id","kind","title"]}}},required:["count","artifacts"]},annotations:E.wyrm_distill,aliases:[],handler:(v,{store:w,memory:j})=>{const{projectPath:m,candidates:_}=v,g=w.getProject(m);if(!g)return{content:[{type:"text",text:`Project not found: ${m}`}],isError:!0};if(!_||_.length===0)return{content:[{type:"text",text:`**Distill**
30
+ Approve/reject with wyrm_review.`})}},{name:"wyrm_distill",description:"Distill a work session into candidate memory artifacts for review. Parses the session's objectives, decisions, and outcomes into structured artifacts (lessons, patterns, anti-patterns) and queues them for approval via wyrm_review. Use at session end to extract institutional knowledge.",inputSchema:{type:"object",properties:{projectPath:{type:"string",description:"Project root path"},sessionId:{type:"string",description:"Session ID to distill"},candidates:{type:"array",description:"Pre-parsed candidate artifacts to store for review",items:{type:"object",properties:{kind:{type:"string",enum:["lesson","pattern","anti_pattern","heuristic","reasoning_trace"]},title:{type:"string"},content:{type:"string"},tags:{type:"array",items:{type:"string"}},confidence:{type:"number"}},required:["kind","title","content"]}}},required:["projectPath","candidates"]},outputSchema:{type:"object",properties:{count:{type:"integer"},artifacts:{type:"array",items:{type:"object",properties:{id:{type:"integer"},kind:{type:"string"},title:{type:"string"}},required:["id","kind","title"]}}},required:["count","artifacts"]},annotations:E.wyrm_distill,aliases:[],handler:(j,{store:v,memory:b})=>{const{projectPath:u,candidates:g}=j,f=v.getProject(u);if(!f)return{content:[{type:"text",text:`Project not found: ${u}`}],isError:!0};if(!g||g.length===0)return{content:[{type:"text",text:`**Distill**
31
31
 
32
- No candidates provided. Provide an array of candidate artifacts to distill.`}],isError:!0};const c=[];for(const i of _){const u=j.add(g.id,{kind:i.kind,problem:i.title,validatedFix:i.content,tags:i.tags??[],confidence:i.confidence??.7,needsReview:1});c.push({id:u.id,kind:i.kind,title:i.title})}const f={count:c.length,artifacts:c};return q(f,(i,u)=>{let a=I(u.brand,`**Distillation Complete** -- ${i.count} artifact${i.count!==1?"s":""} queued for review`)+`
32
+ No candidates provided. Provide an array of candidate artifacts to distill.`}],isError:!0};const a=[];for(const o of g){const y=b.add(f.id,{kind:o.kind,problem:o.title,validatedFix:o.content,tags:o.tags??[],confidence:o.confidence??.7,needsReview:1});a.push({id:y.id,kind:o.kind,title:o.title})}const m={count:a.length,artifacts:a};return q(m,(o,y)=>{let i=I(y.brand,`**Distillation Complete** -- ${o.count} artifact${o.count!==1?"s":""} queued for review`)+`
33
33
 
34
- `;return a+=i.artifacts.map(d=>`${u.bullet} [#${d.id}] **${d.kind}**: ${d.title}`).join(`
35
- `),a+="\n\nUse `wyrm_review` with each ID to approve or reject.",a})}},{name:"wyrm_harvest",description:"Auto-populate memory from artifacts you already produce. Walks a project (or ALL registered projects) and harvests durable facts from its docs (README/CLAUDE/AGENTS/ARCHITECTURE) plus recent commit subjects (git log) into the REVIEW QUEUE \u2014 approve/reject with wyrm_review, nothing is auto-trusted. Idempotent (re-runs skip what's already harvested). Use dryRun to preview. The fix for a thin corpus.",inputSchema:{type:"object",properties:{projectPath:{type:"string",description:"Harvest one project; omit to harvest ALL registered projects"},dryRun:{type:"boolean",description:"Preview what would be harvested without writing anything"},gitLimit:{type:"number",description:"How many recent commits to scan per project (default 30, max 200)"},includeCode:{type:"boolean",description:"Also harvest CODE: tech-stack facts from manifests (package.json/Cargo.toml/\u2026) + TODO/FIXME markers into the review queue, AND index code symbols (functions/classes/types) for search. Heavier \u2014 scope to one project for the full code pass."}}},outputSchema:{type:"object",properties:{dry_run:{type:"boolean"},projects_scanned:{type:"integer"},added:{type:"integer"},skipped:{type:"integer"},top:{type:"array",items:{type:"object",properties:{project:{type:"string"},added:{type:"integer"},skipped:{type:"integer"}},required:["project","added","skipped"]}},sample:{type:"array",items:{type:"string"}},code_symbols:{type:["object","null"],properties:{symbols:{type:"integer"},projects:{type:"integer"},files:{type:"integer"}},required:["symbols","projects","files"]}},required:["dry_run","projects_scanned","added","skipped","top","sample","code_symbols"]},annotations:E.wyrm_harvest,aliases:[],handler:(v,{store:w,raw:j,memory:m,symbols:_,cache:g})=>{const{projectPath:c,dryRun:f,gitLimit:i,includeCode:u}=v,a=j(),d={existsBySig:(r,n)=>!!a.prepare("SELECT 1 FROM memory_artifacts WHERE project_id = ? AND tags LIKE ? ESCAPE '\\' LIMIT 1").get(r,"%"+D(n)+"%"),addCandidate:(r,n)=>{m.add(r,{kind:n.kind,problem:n.text,tags:[...n.tags,n.sig],confidence:n.confidence,needsReview:1,createdBy:"harvest"})}};let p;if(c){const r=w.getProject(c);if(!r)return{content:[{type:"text",text:"Project not found"}],isError:!0};p=[{id:r.id,name:r.name,path:r.path}]}else p=w.getAllProjects(500).map(r=>({id:r.id,name:r.name,path:r.path}));const{reports:s,totalAdded:b,totalSkipped:e}=X(d,p,{dryRun:f,gitLimit:i,includeCode:u});!f&&b>0&&g.invalidate();let t=null;if(u&&!f){let r=0,n=0,x=0;for(const $ of p)try{const k=_.indexProject($.id,$.path);r+=k.files,n+=k.symbols,x++}catch{}t={symbols:n,projects:x,files:r}}const l=s.filter(r=>r.added>0).sort((r,n)=>n.added-r.added).slice(0,15).map(r=>({project:r.project,added:r.added,skipped:r.skipped})),o=s.flatMap(r=>r.sample??[]).slice(0,6),h={dry_run:!!f,projects_scanned:p.length,added:b,skipped:e,top:l,sample:o,code_symbols:t};return q(h,(r,n)=>{const x=r.code_symbols?`
36
- Indexed ${r.code_symbols.symbols} code symbols across ${r.code_symbols.projects} project(s) (${r.code_symbols.files} files) -> searchable via wyrm_symbol_search.`:"",$=r.top.map(S=>` +${String(S.added).padStart(3)} (skip ${S.skipped}) ${S.project}`).join(`
37
- `),k=r.sample.map(S=>` ${n.bullet} ${S}`).join(`
38
- `);return I(n.brand,`Harvest ${r.dry_run?"(dry run) ":""}-- ${r.added} candidate(s) -> review queue across ${r.projects_scanned} project(s); ${r.skipped} already present.`)+`${x}
39
- ${$}`+(k?`
34
+ `;return i+=o.artifacts.map(d=>`${y.bullet} [#${d.id}] **${d.kind}**: ${d.title}`).join(`
35
+ `),i+="\n\nUse `wyrm_review` with each ID to approve or reject.",i})}},{name:"wyrm_harvest",description:"Auto-populate memory from artifacts you already produce. Walks a project (or ALL registered projects) and harvests durable facts from its docs (README/CLAUDE/AGENTS/ARCHITECTURE) plus recent commit subjects (git log) into the REVIEW QUEUE \u2014 approve/reject with wyrm_review, nothing is auto-trusted. Idempotent (re-runs skip what's already harvested). Use dryRun to preview. The fix for a thin corpus.",inputSchema:{type:"object",properties:{projectPath:{type:"string",description:"Harvest one project; omit to harvest ALL registered projects"},dryRun:{type:"boolean",description:"Preview what would be harvested without writing anything"},gitLimit:{type:"number",description:"How many recent commits to scan per project (default 30, max 200)"},includeCode:{type:"boolean",description:"Also harvest CODE: tech-stack facts from manifests (package.json/Cargo.toml/\u2026) + TODO/FIXME markers into the review queue, AND index code symbols (functions/classes/types) for search. Heavier \u2014 scope to one project for the full code pass."}}},outputSchema:{type:"object",properties:{dry_run:{type:"boolean"},projects_scanned:{type:"integer"},added:{type:"integer"},skipped:{type:"integer"},top:{type:"array",items:{type:"object",properties:{project:{type:"string"},added:{type:"integer"},skipped:{type:"integer"}},required:["project","added","skipped"]}},sample:{type:"array",items:{type:"string"}},code_symbols:{type:["object","null"],properties:{symbols:{type:"integer"},projects:{type:"integer"},files:{type:"integer"}},required:["symbols","projects","files"]}},required:["dry_run","projects_scanned","added","skipped","top","sample","code_symbols"]},annotations:E.wyrm_harvest,aliases:[],handler:(j,{store:v,raw:b,memory:u,symbols:g,cache:f})=>{const{projectPath:a,dryRun:m,gitLimit:o,includeCode:y}=j,i=b(),d={existsBySig:(t,$)=>!!i.prepare("SELECT 1 FROM memory_artifacts WHERE project_id = ? AND tags LIKE ? ESCAPE '\\' LIMIT 1").get(t,"%"+D($)+"%"),addCandidate:(t,$)=>{u.add(t,{kind:$.kind,problem:$.text,tags:[...$.tags,$.sig],confidence:$.confidence,needsReview:1,createdBy:"harvest"})}};let p;if(a){const t=v.getProject(a);if(!t)return{content:[{type:"text",text:"Project not found"}],isError:!0};p=[{id:t.id,name:t.name,path:t.path}]}else p=v.getAllProjects(500).map(t=>({id:t.id,name:t.name,path:t.path}));const{reports:c,totalAdded:h,totalSkipped:r}=X(d,p,{dryRun:m,gitLimit:o,includeCode:y});!m&&h>0&&f.invalidate();let e=null;if(y&&!m){let t=0,$=0,w=0;for(const P of p)try{const S=g.indexProject(P.id,P.path);t+=S.files,$+=S.symbols,w++}catch{}e={symbols:$,projects:w,files:t}}const n=c.filter(t=>t.added>0).sort((t,$)=>$.added-t.added).slice(0,15).map(t=>({project:t.project,added:t.added,skipped:t.skipped})),s=c.flatMap(t=>t.sample??[]).slice(0,6),_={dry_run:!!m,projects_scanned:p.length,added:h,skipped:r,top:n,sample:s,code_symbols:e};return q(_,(t,$)=>{const w=t.code_symbols?`
36
+ Indexed ${t.code_symbols.symbols} code symbols across ${t.code_symbols.projects} project(s) (${t.code_symbols.files} files) -> searchable via wyrm_symbol_search.`:"",P=t.top.map(x=>` +${String(x.added).padStart(3)} (skip ${x.skipped}) ${x.project}`).join(`
37
+ `),S=t.sample.map(x=>` ${$.bullet} ${x}`).join(`
38
+ `);return I($.brand,`Harvest ${t.dry_run?"(dry run) ":""}-- ${t.added} candidate(s) -> review queue across ${t.projects_scanned} project(s); ${t.skipped} already present.`)+`${w}
39
+ ${P}`+(S?`
40
40
 
41
41
  Sample:
42
- ${k}`:"")+`
42
+ ${S}`:"")+`
43
43
 
44
- Approve/reject with wyrm_review.`})}},{name:"wyrm_import_git",description:"Import a list of commits into the Wyrm memory review queue. Useful for onboarding a project's history or capturing recent work.",inputSchema:{type:"object",properties:{project_id:{type:"number",description:"Project ID"},commits:{type:"array",description:"Array of commit objects",items:{type:"object",properties:{message:{type:"string"},diff_summary:{type:"string"},author:{type:"string"},date:{type:"string"}},required:["message"]}},auto_approve:{type:"boolean",description:"Skip review queue and activate immediately (default: false)"}},required:["project_id","commits"]},outputSchema:{type:"object",properties:{captured:{type:"integer"},skipped:{type:"integer"},auto_approved:{type:"boolean"}},required:["captured","skipped","auto_approved"]},annotations:E.wyrm_import_git,aliases:[],handler:(v,{store:w,memory:j})=>{const{project_id:m,commits:_,auto_approve:g}=v;if(!w.getProjectById(m))return{content:[{type:"text",text:`Project ID ${m} not found.`}],isError:!0};let f=0,i=0;for(const a of _){const d=a.message??"";if(/^Merge /i.test(d)){i++;continue}if(/^(chore|bump|release|version)/i.test(d)){i++;continue}let p="pattern";/^fix(\(.+\))?:/i.test(d)?p="lesson":/^feat(\(.+\))?:/i.test(d)?p="pattern":/^refactor(\(.+\))?:/i.test(d)&&(p="heuristic");const s=d.split(":")[0]??"commit";j.add(m,{kind:p,problem:d,validatedFix:a.diff_summary??"",whyItWorked:`Committed by ${a.author??"unknown"} on ${a.date??"unknown"}`,tags:["git","commit",s.toLowerCase()],confidence:.6,needsReview:g?0:1}),f++}return q({captured:f,skipped:i,auto_approved:!!g},(a,d)=>I(d.brand,"**Git Import Complete**")+`
44
+ Approve/reject with wyrm_review.`})}},{name:"wyrm_import_git",description:"Import a list of commits into the Wyrm memory review queue. Useful for onboarding a project's history or capturing recent work.",inputSchema:{type:"object",properties:{project_id:{type:"number",description:"Project ID"},commits:{type:"array",description:"Array of commit objects",items:{type:"object",properties:{message:{type:"string"},diff_summary:{type:"string"},author:{type:"string"},date:{type:"string"}},required:["message"]}},auto_approve:{type:"boolean",description:"Skip review queue and activate immediately (default: false)"}},required:["project_id","commits"]},outputSchema:{type:"object",properties:{captured:{type:"integer"},skipped:{type:"integer"},auto_approved:{type:"boolean"}},required:["captured","skipped","auto_approved"]},annotations:E.wyrm_import_git,aliases:[],handler:(j,{store:v,memory:b})=>{const{project_id:u,commits:g,auto_approve:f}=j;if(!v.getProjectById(u))return{content:[{type:"text",text:`Project ID ${u} not found.`}],isError:!0};let m=0,o=0;for(const i of g){const d=i.message??"";if(/^Merge /i.test(d)){o++;continue}if(/^(chore|bump|release|version)/i.test(d)){o++;continue}let p="pattern";/^fix(\(.+\))?:/i.test(d)?p="lesson":/^feat(\(.+\))?:/i.test(d)?p="pattern":/^refactor(\(.+\))?:/i.test(d)&&(p="heuristic");const c=d.split(":")[0]??"commit";b.add(u,{kind:p,problem:d,validatedFix:i.diff_summary??"",whyItWorked:`Committed by ${i.author??"unknown"} on ${i.date??"unknown"}`,tags:["git","commit",c.toLowerCase()],confidence:.6,needsReview:f?0:1}),m++}return q({captured:m,skipped:o,auto_approved:!!f},(i,d)=>I(d.brand,"**Git Import Complete**")+`
45
45
 
46
- ${d.bullet} **Captured:** ${a.captured}
47
- ${d.bullet} **Skipped:** ${a.skipped} (merges/chores)
48
- ${d.bullet} **Review needed:** ${a.auto_approved?"No (auto-approved)":`Yes -- run \`wyrm_review\` to activate ${a.captured} artifact${a.captured!==1?"s":""}`}`)}},{name:"wyrm_import_pr",description:"Import a pull request (title, body, review comments) into the Wyrm memory review queue to extract patterns and heuristics.",inputSchema:{type:"object",properties:{project_id:{type:"number",description:"Project ID"},title:{type:"string",description:"PR title"},body:{type:"string",description:"PR description / body"},review_comments:{type:"array",items:{type:"string"},description:"Review comment strings"},auto_approve:{type:"boolean",description:"Skip review queue (default: false)"}},required:["project_id","title","body"]},outputSchema:{type:"object",properties:{created:{type:"integer"},auto_approved:{type:"boolean"}},required:["created","auto_approved"]},annotations:E.wyrm_import_pr,aliases:[],handler:(v,{store:w,memory:j})=>{const{project_id:m,title:_,body:g,review_comments:c,auto_approve:f}=v;if(!w.getProjectById(m))return{content:[{type:"text",text:`Project ID ${m} not found.`}],isError:!0};let u=0;const a=f?0:1;j.add(m,{kind:"pattern",problem:`${_}
46
+ ${d.bullet} **Captured:** ${i.captured}
47
+ ${d.bullet} **Skipped:** ${i.skipped} (merges/chores)
48
+ ${d.bullet} **Review needed:** ${i.auto_approved?"No (auto-approved)":`Yes -- run \`wyrm_review\` to activate ${i.captured} artifact${i.captured!==1?"s":""}`}`)}},{name:"wyrm_import_pr",description:"Import a pull request (title, body, review comments) into the Wyrm memory review queue to extract patterns and heuristics.",inputSchema:{type:"object",properties:{project_id:{type:"number",description:"Project ID"},title:{type:"string",description:"PR title"},body:{type:"string",description:"PR description / body"},review_comments:{type:"array",items:{type:"string"},description:"Review comment strings"},auto_approve:{type:"boolean",description:"Skip review queue (default: false)"}},required:["project_id","title","body"]},outputSchema:{type:"object",properties:{created:{type:"integer"},auto_approved:{type:"boolean"}},required:["created","auto_approved"]},annotations:E.wyrm_import_pr,aliases:[],handler:(j,{store:v,memory:b})=>{const{project_id:u,title:g,body:f,review_comments:a,auto_approve:m}=j;if(!v.getProjectById(u))return{content:[{type:"text",text:`Project ID ${u} not found.`}],isError:!0};let y=0;const i=m?0:1;b.add(u,{kind:"pattern",problem:`${g}
49
49
 
50
- ${g}`,validatedFix:"",whyItWorked:"",tags:["git","pr"],confidence:.65,needsReview:a}),u++;for(const p of c??[])/\b(should|must|always|never|prefer|avoid|use|don't)\b/i.test(p)&&(j.add(m,{kind:"heuristic",problem:p,validatedFix:"",whyItWorked:"",tags:["git","pr","review"],confidence:.65,needsReview:a}),u++);return q({created:u,auto_approved:!!f},(p,s)=>I(s.brand,"**PR Import Complete**")+`
50
+ ${f}`,validatedFix:"",whyItWorked:"",tags:["git","pr"],confidence:.65,needsReview:i}),y++;for(const p of a??[])/\b(should|must|always|never|prefer|avoid|use|don't)\b/i.test(p)&&(b.add(u,{kind:"heuristic",problem:p,validatedFix:"",whyItWorked:"",tags:["git","pr","review"],confidence:.65,needsReview:i}),y++);return q({created:y,auto_approved:!!m},(p,c)=>I(c.brand,"**PR Import Complete**")+`
51
51
 
52
- ${s.bullet} **Artifacts created:** ${p.created}
53
- ${s.bullet} **Review needed:** ${p.auto_approved?"No (auto-approved)":"Yes -- run `wyrm_review` to activate"}`)}},{name:"wyrm_import_rules",description:"Import a .cursorrules / copilot-instructions file into Wyrm. Parses by section and creates ground truths (for constraint/rule language) or memory artifacts (for general guidelines).",inputSchema:{type:"object",properties:{project_id:{type:"number",description:"Project ID"},content:{type:"string",description:"Full text of the rules file"},format:{type:"string",enum:["cursorrules","copilot","plain"],description:"Source format (default: plain)"},source_file:{type:"string",description:"Filename for provenance (optional)"}},required:["project_id","content"]},outputSchema:{type:"object",properties:{format:{type:"string"},source:{type:"string"},truths_created:{type:"integer"},artifacts_created:{type:"integer"}},required:["format","source","truths_created","artifacts_created"]},annotations:E.wyrm_import_rules,aliases:[],handler:(v,{store:w,memory:j,truths:m})=>{const{project_id:_,content:g,format:c,source_file:f}=v;if(!w.getProjectById(_))return{content:[{type:"text",text:`Project ID ${_} not found.`}],isError:!0};const u=c??"plain",a=f??"rules",d=["imported",u,a],p=g.split(/\n(?=#)/),s=g.split(/\n\n+/),b=(p.length>=s.length?p:s).map(o=>o.trim()).filter(o=>o.length>=15);let e=0,t=0;for(const o of b)/\b(always|never|must|use|don't|avoid|prefer)\b/i.test(o)?(m.set(_,{category:"constraint",key:o.slice(0,50).replace(/\n/g," "),value:o,source:a}),e++):(j.add(_,{kind:"heuristic",problem:o,validatedFix:"",whyItWorked:"",tags:d,confidence:.7,needsReview:1}),t++);return q({format:u,source:a,truths_created:e,artifacts_created:t},(o,h)=>I(h.brand,`**Rules Import Complete** (${o.format})`)+`
52
+ ${c.bullet} **Artifacts created:** ${p.created}
53
+ ${c.bullet} **Review needed:** ${p.auto_approved?"No (auto-approved)":"Yes -- run `wyrm_review` to activate"}`)}},{name:"wyrm_import_rules",description:"Import a .cursorrules / copilot-instructions file into Wyrm. Parses by section and creates ground truths (for constraint/rule language) or memory artifacts (for general guidelines).",inputSchema:{type:"object",properties:{project_id:{type:"number",description:"Project ID"},content:{type:"string",description:"Full text of the rules file"},format:{type:"string",enum:["cursorrules","copilot","plain"],description:"Source format (default: plain)"},source_file:{type:"string",description:"Filename for provenance (optional)"}},required:["project_id","content"]},outputSchema:{type:"object",properties:{format:{type:"string"},source:{type:"string"},truths_created:{type:"integer"},artifacts_created:{type:"integer"}},required:["format","source","truths_created","artifacts_created"]},annotations:E.wyrm_import_rules,aliases:[],handler:(j,{store:v,memory:b,truths:u})=>{const{project_id:g,content:f,format:a,source_file:m}=j;if(!v.getProjectById(g))return{content:[{type:"text",text:`Project ID ${g} not found.`}],isError:!0};const y=a??"plain",i=m??"rules",d=["imported",y,i],p=f.split(/\n(?=#)/),c=f.split(/\n\n+/),h=(p.length>=c.length?p:c).map(s=>s.trim()).filter(s=>s.length>=15);let r=0,e=0;for(const s of h)/\b(always|never|must|use|don't|avoid|prefer)\b/i.test(s)?(u.set(g,{category:"constraint",key:s.slice(0,50).replace(/\n/g," "),value:s,source:i}),r++):(b.add(g,{kind:"heuristic",problem:s,validatedFix:"",whyItWorked:"",tags:d,confidence:.7,needsReview:1}),e++);return q({format:y,source:i,truths_created:r,artifacts_created:e},(s,_)=>I(_.brand,`**Rules Import Complete** (${s.format})`)+`
54
54
 
55
- ${h.bullet} **Ground truths created:** ${o.truths_created} (active immediately)
56
- ${h.bullet} **Memory artifacts created:** ${o.artifacts_created} (pending review)
57
- ${h.bullet} **Source:** ${o.source}
55
+ ${_.bullet} **Ground truths created:** ${s.truths_created} (active immediately)
56
+ ${_.bullet} **Memory artifacts created:** ${s.artifacts_created} (pending review)
57
+ ${_.bullet} **Source:** ${s.source}
58
58
 
59
- Run \`wyrm_review\` to approve the memory artifacts.`)}},{name:"wyrm_spec_register",description:"Make spec-kit Wyrm-native. Reads a spec directory (spec.md title/summary + tasks.md task list) and creates one Wyrm quest per task, linked to a project, with a stored spec\u2192project link. Idempotent \u2014 re-running updates the same quests (deduped by a per-spec-task signature) instead of duplicating.",inputSchema:{type:"object",properties:{specDir:{type:"string",description:"Absolute path to the spec directory (e.g. '.../dragon-platform/specs/001-ghostmesh')"},projectPath:{type:"string",description:"Path of the Wyrm project to attach the spec + quests to (must already be registered)"},priority:{type:"string",enum:["critical","high","medium","low"],description:"Priority for the generated quests (default 'medium')"}},required:["specDir","projectPath"]},outputSchema:{type:"object",properties:{spec_dir:{type:"string"},title:{type:["string","null"]},project:{type:"string"},tasks_parsed:{type:"integer"},quests_created:{type:"integer"},quests_updated:{type:"integer"},quest_ids:{type:"array",items:{type:"integer"}}},required:["spec_dir","title","project","tasks_parsed","quests_created","quests_updated","quest_ids"]},annotations:E.wyrm_spec_register,aliases:[],handler:(v,{store:w,indexing:j})=>{const{specDir:m,projectPath:_,priority:g}=v,c=["specDir","projectPath"].filter(e=>{const t=v[e];return!t&&t!==0&&t!==!1});if(c.length>0)return{content:[{type:"text",text:`Missing required arguments: ${c.join(", ")}`}],isError:!0};const f=w.getProject(_);if(!f)return{content:[{type:"text",text:`**Spec Register**: Project not found at "${_}". Register it first (wyrm_scan_projects / wyrm_session_start).`}],isError:!0};const i=z(m);if(i.tasks.length===0){const e={spec_dir:m,title:i.title??null,project:f.name,tasks_parsed:0,quests_created:0,quests_updated:0,quest_ids:[]};return q(e,(t,l)=>I(l.brand,`**Spec Register**: No tasks found in ${N(t.spec_dir,"tasks.md")}. Nothing to create.`))}const u=g||"medium";let a=0,d=0;const p=[];for(const e of i.tasks){const t=Z(m,e.id),l=`${e.id}: ${e.title}`,o=t,h=w.findQuestBySpecSignature(f.id,t);if(h)w.updateQuestFields(h.id,{title:l,tags:o}),p.push(h.id),d++;else{const r=w.addQuest(f.id,l,`spec-kit task from ${m}`,u,o);j()?.enqueue("quest",r.id,f.id),p.push(r.id),a++}}const s=w.upsertSpec(f.id,m,i.title,i.summary,i.tasks.length),b={spec_dir:s.spec_dir,title:s.title??null,project:f.name,tasks_parsed:i.tasks.length,quests_created:a,quests_updated:d,quest_ids:p};return q(b,(e,t)=>{let l=I(t.brand,"**Spec Registered**")+`
59
+ Run \`wyrm_review\` to approve the memory artifacts.`)}},{name:"wyrm_spec_register",description:"Make spec-kit Wyrm-native. Reads a spec directory (spec.md title/summary + tasks.md task list) and creates one Wyrm quest per task, linked to a project, with a stored spec\u2192project link. Idempotent \u2014 re-running updates the same quests (deduped by a per-spec-task signature) instead of duplicating.",inputSchema:{type:"object",properties:{specDir:{type:"string",description:"Absolute path to the spec directory (e.g. '.../dragon-platform/specs/001-ghostmesh')"},projectPath:{type:"string",description:"Path of the Wyrm project to attach the spec + quests to (must already be registered)"},priority:{type:"string",enum:["critical","high","medium","low"],description:"Priority for the generated quests (default 'medium')"}},required:["specDir","projectPath"]},outputSchema:{type:"object",properties:{spec_dir:{type:"string"},title:{type:["string","null"]},project:{type:"string"},tasks_parsed:{type:"integer"},quests_created:{type:"integer"},quests_updated:{type:"integer"},quest_ids:{type:"array",items:{type:"integer"}}},required:["spec_dir","title","project","tasks_parsed","quests_created","quests_updated","quest_ids"]},annotations:E.wyrm_spec_register,aliases:[],handler:(j,{store:v,indexing:b})=>{const{specDir:u,projectPath:g,priority:f}=j,a=["specDir","projectPath"].filter(r=>{const e=j[r];return!e&&e!==0&&e!==!1});if(a.length>0)return{content:[{type:"text",text:`Missing required arguments: ${a.join(", ")}`}],isError:!0};const m=v.getProject(g);if(!m)return{content:[{type:"text",text:`**Spec Register**: Project not found at "${g}". Register it first (wyrm_scan_projects / wyrm_session_start).`}],isError:!0};const o=z(u);if(o.tasks.length===0){const r={spec_dir:u,title:o.title??null,project:m.name,tasks_parsed:0,quests_created:0,quests_updated:0,quest_ids:[]};return q(r,(e,n)=>I(n.brand,`**Spec Register**: No tasks found in ${N(e.spec_dir,"tasks.md")}. Nothing to create.`))}const y=f||"medium";let i=0,d=0;const p=[];for(const r of o.tasks){const e=Z(u,r.id),n=`${r.id}: ${r.title}`,s=e,_=v.findQuestBySpecSignature(m.id,e);if(_)v.updateQuestFields(_.id,{title:n,tags:s}),p.push(_.id),d++;else{const t=v.addQuest(m.id,n,`spec-kit task from ${u}`,y,s);b()?.enqueue("quest",t.id,m.id),p.push(t.id),i++}}const c=v.upsertSpec(m.id,u,o.title,o.summary,o.tasks.length),h={spec_dir:c.spec_dir,title:c.title??null,project:m.name,tasks_parsed:o.tasks.length,quests_created:i,quests_updated:d,quest_ids:p};return q(h,(r,e)=>{let n=I(e.brand,"**Spec Registered**")+`
60
60
 
61
- `;return l+=`Spec: ${e.title||"(untitled)"}
62
- `,s.summary&&(l+=`Summary: ${s.summary}
63
- `),l+=`Dir: ${e.spec_dir}
64
- `,l+=`Project: ${e.project}
65
- `,l+=`Tasks parsed: ${e.tasks_parsed}
66
- `,l+=`Quests created: ${e.quests_created} - updated: ${e.quests_updated}
67
- `,l+=`
61
+ `;return n+=`Spec: ${r.title||"(untitled)"}
62
+ `,c.summary&&(n+=`Summary: ${c.summary}
63
+ `),n+=`Dir: ${r.spec_dir}
64
+ `,n+=`Project: ${r.project}
65
+ `,n+=`Tasks parsed: ${r.tasks_parsed}
66
+ `,n+=`Quests created: ${r.quests_created} - updated: ${r.quests_updated}
67
+ `,n+=`
68
68
  \`\`\`json
69
- ${JSON.stringify({spec:e.spec_dir,title:e.title,project:e.project,tasksParsed:e.tasks_parsed,questsCreated:e.quests_created,questsUpdated:e.quests_updated,questIds:e.quest_ids},null,2)}
70
- \`\`\``,l})}},{name:"wyrm_scaffold_save",description:"Save a reasoning scaffold \u2014 a structured checklist that guides step-by-step thinking for a specific problem type. Scaffolds are automatically surfaced by wyrm_context_build when the task matches, helping AI models apply proven reasoning patterns.",inputSchema:{type:"object",properties:{projectPath:{type:"string",description:"Project path (optional, null for global scaffolds)"},problemType:{type:"string",description:"Short slug for the problem type (e.g. 'api-design', 'security-review', 'db-migration')"},description:{type:"string",description:"What kind of task this scaffold helps with"},whenToUse:{type:"string",description:"Conditions that indicate this scaffold should be applied"},steps:{type:"array",items:{type:"string"},description:"Ordered checklist steps to follow"},verificationSteps:{type:"array",items:{type:"string"},description:"Steps to verify the work is correct"},doNotApplyIf:{type:"string",description:"Conditions where this scaffold does NOT apply"},tags:{type:"array",items:{type:"string"},description:"Searchable tags"}},required:["problemType","description","whenToUse","steps"]},outputSchema:{type:"object",properties:{id:{type:"integer"},problem_type:{type:"string"},description:{type:"string"},steps:{type:"integer"}},required:["id","problem_type","description","steps"]},annotations:E.wyrm_scaffold_save,aliases:[],handler:(v,{store:w,scaffolds:j,cache:m})=>{const{projectPath:_,problemType:g,description:c,whenToUse:f,steps:i,verificationSteps:u,doNotApplyIf:a,tags:d}=v,p=_?w.getProject(_)?.id??void 0:void 0,s=j.save({projectId:p,problemType:g,description:c,whenToUse:f,steps:i,verificationSteps:u??void 0,doNotApplyIf:a?[a]:void 0,tags:d??[]});m.invalidate("wyrm_scaffold_get"),m.invalidate("wyrm_context_build");const b={id:s.id,problem_type:g,description:c,steps:i.length};return q(b,(e,t)=>I(t.brand,"**Reasoning Scaffold Saved**")+`
69
+ ${JSON.stringify({spec:r.spec_dir,title:r.title,project:r.project,tasksParsed:r.tasks_parsed,questsCreated:r.quests_created,questsUpdated:r.quests_updated,questIds:r.quest_ids},null,2)}
70
+ \`\`\``,n})}},{name:"wyrm_scaffold_save",description:"Save a reasoning scaffold \u2014 a structured checklist that guides step-by-step thinking for a specific problem type. Scaffolds are automatically surfaced by wyrm_context_build when the task matches, helping AI models apply proven reasoning patterns.",inputSchema:{type:"object",properties:{projectPath:{type:"string",description:"Project path (optional, null for global scaffolds)"},problemType:{type:"string",description:"Short slug for the problem type (e.g. 'api-design', 'security-review', 'db-migration')"},description:{type:"string",description:"What kind of task this scaffold helps with"},whenToUse:{type:"string",description:"Conditions that indicate this scaffold should be applied"},steps:{type:"array",items:{type:"string"},description:"Ordered checklist steps to follow"},verificationSteps:{type:"array",items:{type:"string"},description:"Steps to verify the work is correct"},doNotApplyIf:{type:"string",description:"Conditions where this scaffold does NOT apply"},tags:{type:"array",items:{type:"string"},description:"Searchable tags"}},required:["problemType","description","whenToUse","steps"]},outputSchema:{type:"object",properties:{id:{type:"integer"},problem_type:{type:"string"},description:{type:"string"},steps:{type:"integer"}},required:["id","problem_type","description","steps"]},annotations:E.wyrm_scaffold_save,aliases:[],handler:(j,{store:v,scaffolds:b,cache:u})=>{const{projectPath:g,problemType:f,description:a,whenToUse:m,steps:o,verificationSteps:y,doNotApplyIf:i,tags:d}=j,p=g?v.getProject(g)?.id??void 0:void 0,c=b.save({projectId:p,problemType:f,description:a,whenToUse:m,steps:o,verificationSteps:y??void 0,doNotApplyIf:i?[i]:void 0,tags:d??[]});u.invalidate("wyrm_scaffold_get"),u.invalidate("wyrm_context_build");const h={id:c.id,problem_type:f,description:a,steps:o.length};return q(h,(r,e)=>I(e.brand,"**Reasoning Scaffold Saved**")+`
71
71
 
72
- ${t.bullet} **Problem Type:** ${e.problem_type}
73
- ${t.bullet} **Description:** ${e.description}
74
- ${t.bullet} **Steps:** ${e.steps} checklist items
75
- ${t.bullet} **ID:** ${e.id}
72
+ ${e.bullet} **Problem Type:** ${r.problem_type}
73
+ ${e.bullet} **Description:** ${r.description}
74
+ ${e.bullet} **Steps:** ${r.steps} checklist items
75
+ ${e.bullet} **ID:** ${r.id}
76
76
 
77
- This scaffold will be surfaced by \`wyrm_context_build\` when tasks match "${e.problem_type}".`)}}];export{ye as captureToolSpecs};
77
+ This scaffold will be surfaced by \`wyrm_context_build\` when tasks match "${r.problem_type}".`)}}];export{ye as captureToolSpecs};