@soleri/forge 5.13.1 → 5.14.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 (102) hide show
  1. package/dist/index.js +0 -0
  2. package/dist/lib.d.ts +1 -0
  3. package/dist/lib.js +1 -0
  4. package/dist/lib.js.map +1 -1
  5. package/dist/skills/brain-debrief.md +47 -19
  6. package/dist/skills/brainstorming.md +19 -9
  7. package/dist/skills/code-patrol.md +21 -19
  8. package/dist/skills/context-resume.md +14 -11
  9. package/dist/skills/executing-plans.md +30 -15
  10. package/dist/skills/fix-and-learn.md +17 -14
  11. package/dist/skills/health-check.md +29 -23
  12. package/dist/skills/knowledge-harvest.md +27 -20
  13. package/dist/skills/onboard-me.md +16 -15
  14. package/dist/skills/retrospective.md +34 -18
  15. package/dist/skills/second-opinion.md +16 -9
  16. package/dist/skills/systematic-debugging.md +40 -29
  17. package/dist/skills/test-driven-development.md +45 -30
  18. package/dist/skills/vault-capture.md +31 -15
  19. package/dist/skills/vault-navigator.md +24 -13
  20. package/dist/skills/verification-before-completion.md +38 -26
  21. package/dist/skills/writing-plans.md +21 -13
  22. package/dist/templates/claude-md-template.d.ts +9 -8
  23. package/dist/templates/claude-md-template.js +36 -32
  24. package/dist/templates/claude-md-template.js.map +1 -1
  25. package/dist/templates/inject-claude-md.js +65 -25
  26. package/dist/templates/inject-claude-md.js.map +1 -1
  27. package/dist/templates/shared-rules.d.ts +10 -11
  28. package/dist/templates/shared-rules.js +242 -114
  29. package/dist/templates/shared-rules.js.map +1 -1
  30. package/package.json +1 -1
  31. package/src/lib.ts +1 -0
  32. package/src/templates/claude-md-template.ts +49 -77
  33. package/src/templates/inject-claude-md.ts +65 -25
  34. package/src/templates/shared-rules.ts +259 -121
  35. package/dist/skills/skills/brain-debrief.md +0 -214
  36. package/dist/skills/skills/brainstorming.md +0 -180
  37. package/dist/skills/skills/code-patrol.md +0 -178
  38. package/dist/skills/skills/context-resume.md +0 -146
  39. package/dist/skills/skills/executing-plans.md +0 -216
  40. package/dist/skills/skills/fix-and-learn.md +0 -167
  41. package/dist/skills/skills/health-check.md +0 -231
  42. package/dist/skills/skills/knowledge-harvest.md +0 -185
  43. package/dist/skills/skills/onboard-me.md +0 -198
  44. package/dist/skills/skills/retrospective.md +0 -205
  45. package/dist/skills/skills/second-opinion.md +0 -149
  46. package/dist/skills/skills/systematic-debugging.md +0 -241
  47. package/dist/skills/skills/test-driven-development.md +0 -281
  48. package/dist/skills/skills/vault-capture.md +0 -170
  49. package/dist/skills/skills/vault-navigator.md +0 -140
  50. package/dist/skills/skills/verification-before-completion.md +0 -182
  51. package/dist/skills/skills/writing-plans.md +0 -215
  52. package/dist/templates/brain.d.ts +0 -6
  53. package/dist/templates/brain.js +0 -478
  54. package/dist/templates/brain.js.map +0 -1
  55. package/dist/templates/core-facade.d.ts +0 -6
  56. package/dist/templates/core-facade.js +0 -564
  57. package/dist/templates/core-facade.js.map +0 -1
  58. package/dist/templates/facade-factory.d.ts +0 -1
  59. package/dist/templates/facade-factory.js +0 -63
  60. package/dist/templates/facade-factory.js.map +0 -1
  61. package/dist/templates/facade-types.d.ts +0 -1
  62. package/dist/templates/facade-types.js +0 -46
  63. package/dist/templates/facade-types.js.map +0 -1
  64. package/dist/templates/intelligence-loader.d.ts +0 -1
  65. package/dist/templates/intelligence-loader.js +0 -43
  66. package/dist/templates/intelligence-loader.js.map +0 -1
  67. package/dist/templates/intelligence-types.d.ts +0 -1
  68. package/dist/templates/intelligence-types.js +0 -24
  69. package/dist/templates/intelligence-types.js.map +0 -1
  70. package/dist/templates/llm-client.d.ts +0 -7
  71. package/dist/templates/llm-client.js +0 -300
  72. package/dist/templates/llm-client.js.map +0 -1
  73. package/dist/templates/llm-key-pool.d.ts +0 -7
  74. package/dist/templates/llm-key-pool.js +0 -211
  75. package/dist/templates/llm-key-pool.js.map +0 -1
  76. package/dist/templates/llm-types.d.ts +0 -5
  77. package/dist/templates/llm-types.js +0 -161
  78. package/dist/templates/llm-types.js.map +0 -1
  79. package/dist/templates/llm-utils.d.ts +0 -5
  80. package/dist/templates/llm-utils.js +0 -260
  81. package/dist/templates/llm-utils.js.map +0 -1
  82. package/dist/templates/planner.d.ts +0 -5
  83. package/dist/templates/planner.js +0 -150
  84. package/dist/templates/planner.js.map +0 -1
  85. package/dist/templates/test-brain.d.ts +0 -6
  86. package/dist/templates/test-brain.js +0 -474
  87. package/dist/templates/test-brain.js.map +0 -1
  88. package/dist/templates/test-llm.d.ts +0 -7
  89. package/dist/templates/test-llm.js +0 -574
  90. package/dist/templates/test-llm.js.map +0 -1
  91. package/dist/templates/test-loader.d.ts +0 -5
  92. package/dist/templates/test-loader.js +0 -146
  93. package/dist/templates/test-loader.js.map +0 -1
  94. package/dist/templates/test-planner.d.ts +0 -5
  95. package/dist/templates/test-planner.js +0 -271
  96. package/dist/templates/test-planner.js.map +0 -1
  97. package/dist/templates/test-vault.d.ts +0 -5
  98. package/dist/templates/test-vault.js +0 -380
  99. package/dist/templates/test-vault.js.map +0 -1
  100. package/dist/templates/vault.d.ts +0 -5
  101. package/dist/templates/vault.js +0 -263
  102. package/dist/templates/vault.js.map +0 -1
@@ -1,119 +1,247 @@
1
1
  /**
2
- * Shared behavioral rules that every Soleri agent ships with.
2
+ * Shared Soleri engine rules agent-agnostic.
3
3
  *
4
- * These rules are agent-agnostic and mirror the quality of Salvador's
5
- * hand-crafted CLAUDE.md behavioral sections. They cover:
6
- * - Vault-first knowledge protocol
7
- * - Planning enforcement (two-gate approval)
8
- * - Output formatting (plan metadata tables, drift reports)
9
- * - Knowledge capture discipline
10
- * - Intent routing
11
- * - Session lifecycle
4
+ * These rules are injected ONCE into global ~/.claude/CLAUDE.md under
5
+ * the `<!-- soleri:engine-rules -->` marker. They describe behavioral
6
+ * rules WITHOUT tool prefixes. The active agent's facade table (in its
7
+ * own `<!-- agent-id:mode -->` block) maps op names to actual tools.
8
+ *
9
+ * Uses op:name syntax — the active agent provides the tool prefix.
12
10
  */
13
- /** Returns markdown lines for all shared behavioral sections. */
14
- export function getSharedRules(toolPrefix) {
15
- const bt = '`';
16
- return [
17
- // ─── Vault-First Protocol ────────────────────────────────
18
- '## Vault as Source of Truth',
19
- '',
20
- 'Before every decision — planning, design, architecture, problem-solving — consult the vault.',
21
- '',
22
- '**Lookup order:**',
23
- `1. Vault — ${bt}${toolPrefix}_core op:search_intelligent params:{ query: "..." }${bt}`,
24
- '2. Codebase — only if vault has nothing',
25
- '3. Web / training knowledge — last resort',
26
- '',
27
- 'If the vault has a pattern, follow it. If it has an anti-pattern, avoid it.',
28
- '',
29
- // ─── Planning Enforcement ────────────────────────────────
30
- '## Planning',
31
- '',
32
- 'For multi-step tasks, use the planning system. **Never skip gates.**',
33
- '',
34
- '**Lifecycle:**',
35
- `${bt}draft → approved (Gate 1) → tasks approved (Gate 2) → executing → reconciling → completed${bt}`,
36
- '',
37
- '**Sequence:**',
38
- `1. Create: ${bt}${toolPrefix}_core op:create_plan params:{ objective: "...", scope: "...", tasks: [...] }${bt}`,
39
- `2. Approve plan (Gate 1): ${bt}${toolPrefix}_core op:approve_plan params:{ planId: "..." }${bt}`,
40
- `3. Split tasks (Gate 2): ${bt}${toolPrefix}_core op:plan_split params:{ planId: "..." }${bt}`,
41
- `4. Track: ${bt}${toolPrefix}_core op:update_task params:{ planId: "...", taskId: "...", status: "completed" }${bt}`,
42
- `5. Reconcile: ${bt}${toolPrefix}_core op:plan_reconcile params:{ planId: "..." }${bt}`,
43
- `6. Complete: ${bt}${toolPrefix}_core op:plan_complete_lifecycle params:{ planId: "..." }${bt}`,
44
- '',
45
- 'Wait for explicit user approval before proceeding past each gate.',
46
- 'Check activation response for recovered plans in `executing` state — remind the user.',
47
- '',
48
- '**Exceptions:** Read-only operations, user says "just do it", single-line fixes.',
49
- '',
50
- // ─── Output Formatting ───────────────────────────────────
51
- '## Output Formatting',
52
- '',
53
- '**Plan metadata** — always show at top of every plan summary:',
54
- '',
55
- '| Field | Value |',
56
- '|-------|-------|',
57
- '| **Plan ID** | {planId} |',
58
- '| **Check ID** | {checkId} |',
59
- '| **Grade** | {grade} ({score}/100) |',
60
- '| **Status** | {status} |',
61
- '',
62
- '**Drift reports:**',
63
- '',
64
- '| Field | Value |',
65
- '|-------|-------|',
66
- '| **Accuracy** | {accuracyScore}/100 |',
67
- '| **Drift Items** | {count} |',
68
- '',
69
- '| Type | Description | Impact |',
70
- '|------|-------------|--------|',
71
- '| skipped | ... | medium |',
72
- '',
73
- // ─── Knowledge Capture ───────────────────────────────────
74
- '## Knowledge Capture',
75
- '',
76
- "When learning something that should persist, capture it — don't just promise to remember.",
77
- '',
78
- `- Domain knowledge: ${bt}${toolPrefix}_core op:capture_quick params:{ title: "...", description: "..." }${bt}`,
79
- `- Batch capture: ${bt}${toolPrefix}_core op:capture_knowledge params:{ entries: [...] }${bt}`,
80
- `- Intelligent search: ${bt}${toolPrefix}_core op:search_intelligent params:{ query: "..." }${bt}`,
81
- '',
82
- // ─── Intent Detection ────────────────────────────────────
83
- '## Intent Detection',
84
- '',
85
- 'A UserPromptSubmit hook auto-classifies prompts. When you see a `[MODE-NAME]` indicator:',
86
- '',
87
- `1. Call ${bt}${toolPrefix}_core op:route_intent params:{ prompt: "<user message>" }${bt}`,
88
- '2. Follow the returned behavior rules',
89
- '3. Briefly acknowledge mode changes',
90
- '',
91
- '| Signal | Intent |',
92
- '|--------|--------|',
93
- '| Problem described ("broken", "janky", "weird") | FIX |',
94
- '| Need expressed ("I need", "we should have") | BUILD |',
95
- '| Quality questioned ("is this right?") | REVIEW |',
96
- '| Advice sought ("how should I", "best way") | PLAN |',
97
- '| Improvement requested ("make it faster") | IMPROVE |',
98
- '| Ready to ship ("deploy", "release") | DELIVER |',
99
- '',
100
- // ─── Session Lifecycle ───────────────────────────────────
101
- '## Session Lifecycle',
102
- '',
103
- 'A PreCompact hook calls `session_capture` before context compaction.',
104
- `Manual capture: ${bt}${toolPrefix}_core op:session_capture params:{ summary: "..." }${bt}`,
105
- '',
106
- // ─── Orchestration ───────────────────────────────────────
107
- '## Orchestration',
108
- '',
109
- 'For complex workflows, use the orchestration layer instead of manual planning:',
110
- '',
111
- `1. Plan: ${bt}${toolPrefix}_core op:orchestrate_plan params:{ prompt: "...", projectPath: "." }${bt}`,
112
- `2. Execute: ${bt}${toolPrefix}_core op:orchestrate_execute params:{ planId: "..." }${bt}`,
113
- `3. Complete: ${bt}${toolPrefix}_core op:orchestrate_complete params:{ planId: "..." }${bt}`,
114
- '',
115
- 'The orchestrator handles vault lookup, brain recommendations, and knowledge capture automatically.',
116
- '',
117
- ];
11
+ const ENGINE_MARKER = 'soleri:engine-rules';
12
+ export function getEngineMarker() {
13
+ return ENGINE_MARKER;
14
+ }
15
+ /** Returns the full engine rules markdown content (with markers). */
16
+ export function getEngineRulesContent() {
17
+ return ENGINE_RULES_LINES.join('\n');
118
18
  }
19
+ const ENGINE_RULES_LINES = [
20
+ `<!-- ${ENGINE_MARKER} -->`,
21
+ '',
22
+ '# Soleri Engine Rules',
23
+ '',
24
+ "Shared behavioral rules for all Soleri agents. The active agent's facade table provides tool names.",
25
+ '',
26
+ // ─── Response Integrity ─────────────────────────────────
27
+ '## Response Integrity',
28
+ '<!-- soleri:response-integrity -->',
29
+ '',
30
+ '- If you\'re not confident in your answer, say "I\'m not sure" and explain why. Never guess.',
31
+ '- After every response, rate your confidence from 1 to 10. Anything below 7, flag it.',
32
+ '',
33
+ // ─── Memory Quality Gate ───────────────────────────────
34
+ '## Memory Quality Gate',
35
+ '<!-- soleri:memory-quality -->',
36
+ '',
37
+ '**MANDATORY** before writing to auto memory: apply the **"Will I hit this again?"** test.',
38
+ '',
39
+ '**SAVE** — recurring bugs, non-obvious gotchas, structural issues, behavioral quirks that will resurface.',
40
+ "**NEVER SAVE** — one-time config, solved-and-done fixes, values already persisted in files, setup steps that won't repeat, anything where the fix is already in the codebase.",
41
+ '',
42
+ "If in doubt, don't save. Less memory with high signal beats more memory with noise.",
43
+ '',
44
+ // ─── Vault-First Protocol ────────────────────────────────
45
+ '## Vault as Source of Truth',
46
+ '<!-- soleri:vault-protocol -->',
47
+ '',
48
+ '- **MANDATORY**: Consult the vault BEFORE every decision — planning, design, architecture, patterns, problem-solving.',
49
+ '- Lookup order: 1) VAULT (`op:search_intelligent`) → 2) MEMORY (`op:memory_search`) → 3) CODEBASE → 4) WEB/TRAINING.',
50
+ '- If the vault has a pattern, follow it. If it has an anti-pattern, avoid it.',
51
+ '- Persist lessons: call `op:capture_knowledge` — don\'t just promise "I will remember this".',
52
+ '- Exceptions: runtime errors with stack traces → codebase first; user explicitly asks to search web.',
53
+ '',
54
+ // ─── Planning ────────────────────────────────────────────
55
+ '## Planning',
56
+ '<!-- soleri:planning -->',
57
+ '',
58
+ '- Use `op:create_plan` before writing ANY code. Show the plan, wait for approval.',
59
+ '- Two-gate approval: Gate 1 (`op:approve_plan`), Gate 2 (`op:plan_split`). Never skip either.',
60
+ '- Wait for explicit "yes" / "approve" before proceeding past each gate.',
61
+ '- After execution: `op:plan_reconcile` (drift report) then `op:plan_complete_lifecycle` (knowledge capture, archive).',
62
+ '- Never let a plan stay in `executing` or `reconciling` state without reminding the user.',
63
+ '- On session start: check for plans in `executing`/`reconciling` state and remind.',
64
+ '- Exceptions: read-only operations, user says "just do it", single-line fixes.',
65
+ '',
66
+ '### Lifecycle States',
67
+ '',
68
+ '| State | Expires | Next Action |',
69
+ '|-------|---------|-------------|',
70
+ '| `draft` | 30 min | `op:create_plan` (iterate) |',
71
+ '| `approved` | 30 min | `op:plan_split` |',
72
+ '| `executing` | Never | `op:plan_reconcile` |',
73
+ '| `reconciling` | Never | `op:plan_complete_lifecycle` |',
74
+ '| `completed` | — | Done |',
75
+ '',
76
+ '### Plan Presentation',
77
+ '',
78
+ 'Every plan summary MUST include this format:',
79
+ '',
80
+ '```',
81
+ '## Plan: [Short Title]',
82
+ '',
83
+ '| Field | Value |',
84
+ '|-------|-------|',
85
+ '| **Plan ID** | {planId} |',
86
+ '| **Check ID** | {checkId} |',
87
+ '| **Grade** | {grade} ({score}/100) |',
88
+ '| **Status** | {status} |',
89
+ '| **Lifecycle** | {lifecycleStatus} |',
90
+ '',
91
+ '**Objective:** [One sentence]',
92
+ '',
93
+ '**Scope:**',
94
+ '| Included | Excluded |',
95
+ '|----------|----------|',
96
+ '| item 1 | item 1 |',
97
+ '',
98
+ '**Approach:**',
99
+ '| Step | Task |',
100
+ '|------|------|',
101
+ '| 1 | Description |',
102
+ '```',
103
+ '',
104
+ 'Without visible IDs, users cannot resume, reference, or approve plans.',
105
+ '',
106
+ '### Drift Report',
107
+ '',
108
+ '```',
109
+ '| Field | Value |',
110
+ '|-------|-------|',
111
+ '| **Accuracy** | {accuracyScore}/100 |',
112
+ '| **Drift Items** | {count} |',
113
+ '',
114
+ '| Type | Description | Impact | Rationale |',
115
+ '|------|-------------|--------|-----------|',
116
+ '| skipped | ... | medium | ... |',
117
+ '```',
118
+ '',
119
+ // ─── Output Formatting ───────────────────────────────────
120
+ '## Output Formatting',
121
+ '<!-- soleri:output-formatting -->',
122
+ '',
123
+ '**MANDATORY**: Present tool outputs in human-readable format, NOT raw JSON.',
124
+ '',
125
+ '**Tasks** — show as numbered table:',
126
+ '```',
127
+ '| # | Type | Task | Complexity |',
128
+ '|---|------|------|------------|',
129
+ '| 1 | Impl | ... | High |',
130
+ '```',
131
+ '',
132
+ '**Completion** — show outcome, knowledge captured count, archive path.',
133
+ '',
134
+ '**Status lines** — `Persisted: X plans, Y tasks, Z checks` / `Recovered: X plans, Y tasks`',
135
+ '',
136
+ // ─── Clean Commits ───────────────────────────────────────
137
+ '## Clean Commits',
138
+ '<!-- soleri:clean-commits -->',
139
+ '',
140
+ '**MANDATORY**: No AI attribution in commit messages.',
141
+ '',
142
+ 'Blocked patterns:',
143
+ '- `Co-Authored-By: Claude` (any variant)',
144
+ '- `noreply@anthropic.com`',
145
+ '- `Generated with Claude`, `AI-generated`',
146
+ '- Any mention of `Anthropic`, `Claude Opus`, `Claude Sonnet`, `Claude Haiku`',
147
+ '',
148
+ 'Use conventional commits:',
149
+ '```',
150
+ 'feat: add user authentication',
151
+ 'fix: resolve login timeout issue',
152
+ 'refactor: simplify data fetching logic',
153
+ '```',
154
+ '',
155
+ // ─── Knowledge Capture ───────────────────────────────────
156
+ '## Knowledge Capture',
157
+ '<!-- soleri:knowledge-capture -->',
158
+ '',
159
+ "**MANDATORY**: Persist lessons, don't just promise them.",
160
+ '',
161
+ 'When you learn something that should persist:',
162
+ '1. **DON\'T** just say "I will remember this"',
163
+ '2. **DO** call `op:capture_knowledge` to persist to vault',
164
+ "3. **DO** update relevant files if it's a behavioral change",
165
+ '',
166
+ '| Type | Op | Persists To |',
167
+ '|------|-----|-------------|',
168
+ '| Patterns/Anti-patterns | `op:capture_knowledge` | vault |',
169
+ '| Quick capture | `op:capture_quick` | vault |',
170
+ '| Session summaries | `op:session_capture` | memory |',
171
+ '',
172
+ // ─── Work Task Routing ───────────────────────────────────
173
+ '## Work Task Routing',
174
+ '<!-- soleri:task-routing -->',
175
+ '',
176
+ 'Use the orchestration layer for ALL work tasks:',
177
+ '- `op:orchestrate_plan` → vault + brain + structured plan.',
178
+ '- `op:orchestrate_execute` → execution tracking.',
179
+ '- `op:orchestrate_complete` → epilogue (vault, session).',
180
+ '',
181
+ 'The orchestrator handles vault lookup, brain recommendations, and knowledge capture automatically.',
182
+ '',
183
+ // ─── Intent Detection ────────────────────────────────────
184
+ '## Intent Detection',
185
+ '<!-- soleri:intent-detection -->',
186
+ '',
187
+ '**Semantic-First**: Analyze user MEANING before calling `op:route_intent`.',
188
+ '',
189
+ '| Signal | Intent |',
190
+ '|--------|--------|',
191
+ '| Problem described ("broken", "janky", "weird") | FIX |',
192
+ '| Need expressed ("I need", "we should have") | BUILD |',
193
+ '| Quality questioned ("is this right?") | REVIEW |',
194
+ '| Advice sought ("how should I", "best way") | PLAN |',
195
+ '| Improvement requested ("make it faster") | IMPROVE |',
196
+ '| Ready to ship ("deploy", "release") | DELIVER |',
197
+ '',
198
+ 'Use `op:route_intent` only to CONFIRM your analysis or when meaning is unclear.',
199
+ '',
200
+ // ─── Validation Loop ─────────────────────────────────────
201
+ '## Iterative Validation Loop',
202
+ '<!-- soleri:validation-loop -->',
203
+ '',
204
+ '- When a user gives a **work task**, start a loop: `op:loop_start params:{ prompt: "<task>", mode: "custom" }`',
205
+ '- Do NOT start loops for: questions, explanations, status checks, git operations, exploration, simple one-line fixes.',
206
+ '',
207
+ '| Mode | Op | Target | Max Iter |',
208
+ '|------|-----|--------|----------|',
209
+ '| `plan-iteration` | `op:create_plan` | grade >= A | 10 |',
210
+ '| `custom` | user-defined | promise-based | 20 |',
211
+ '',
212
+ // ─── Brain-Informed Work ─────────────────────────────────
213
+ '## Brain-Informed Work',
214
+ '<!-- soleri:brain -->',
215
+ '',
216
+ '- Brain patterns surface at session start. For relevant patterns, pull rules just-in-time from the vault.',
217
+ '- Brain tells you **which** patterns matter (names + strength scores). Vault tells you **what** they are (rules, examples).',
218
+ "- Pull only what's relevant to the current task — don't load everything at session start.",
219
+ '',
220
+ // ─── Cross-Project Memory ────────────────────────────────
221
+ '## Cross-Project Memory',
222
+ '<!-- soleri:cross-project -->',
223
+ '',
224
+ '- Use `crossProject: true` in `op:memory_search` for patterns across related projects.',
225
+ '- Promote universal patterns to global pool with `op:memory_promote_to_global`.',
226
+ '',
227
+ // ─── Session Lifecycle ───────────────────────────────────
228
+ '## Session Lifecycle',
229
+ '<!-- soleri:session -->',
230
+ '',
231
+ '### Session Start Protocol',
232
+ '',
233
+ 'On EVERY new session:',
234
+ '1. Register project: `op:register params:{ projectPath: "." }`',
235
+ '2. Check activation response for `persistence.status`, `vault.connected`, `project.registered`.',
236
+ '3. Check for plans awaiting reconciliation via `op:check_persistence`:',
237
+ ' - `executing` → Remind user to call `op:plan_reconcile`.',
238
+ ' - `reconciling` → Remind user to call `op:plan_complete_lifecycle`.',
239
+ '',
240
+ '### Context Compaction',
241
+ '',
242
+ 'A PreCompact hook calls `op:session_capture` before context compaction.',
243
+ 'Manual capture: `op:session_capture params:{ summary: "..." }`',
244
+ '',
245
+ `<!-- /${ENGINE_MARKER} -->`,
246
+ ];
119
247
  //# sourceMappingURL=shared-rules.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared-rules.js","sourceRoot":"","sources":["../../src/templates/shared-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,iEAAiE;AACjE,MAAM,UAAU,cAAc,CAAC,UAAkB;IAC/C,MAAM,EAAE,GAAG,GAAG,CAAC;IAEf,OAAO;QACL,4DAA4D;QAC5D,6BAA6B;QAC7B,EAAE;QACF,8FAA8F;QAC9F,EAAE;QACF,mBAAmB;QACnB,cAAc,EAAE,GAAG,UAAU,sDAAsD,EAAE,EAAE;QACvF,yCAAyC;QACzC,2CAA2C;QAC3C,EAAE;QACF,6EAA6E;QAC7E,EAAE;QAEF,4DAA4D;QAC5D,aAAa;QACb,EAAE;QACF,sEAAsE;QACtE,EAAE;QACF,gBAAgB;QAChB,GAAG,EAAE,4FAA4F,EAAE,EAAE;QACrG,EAAE;QACF,eAAe;QACf,cAAc,EAAE,GAAG,UAAU,+EAA+E,EAAE,EAAE;QAChH,6BAA6B,EAAE,GAAG,UAAU,iDAAiD,EAAE,EAAE;QACjG,4BAA4B,EAAE,GAAG,UAAU,+CAA+C,EAAE,EAAE;QAC9F,aAAa,EAAE,GAAG,UAAU,oFAAoF,EAAE,EAAE;QACpH,iBAAiB,EAAE,GAAG,UAAU,mDAAmD,EAAE,EAAE;QACvF,gBAAgB,EAAE,GAAG,UAAU,4DAA4D,EAAE,EAAE;QAC/F,EAAE;QACF,mEAAmE;QACnE,uFAAuF;QACvF,EAAE;QACF,kFAAkF;QAClF,EAAE;QAEF,4DAA4D;QAC5D,sBAAsB;QACtB,EAAE;QACF,+DAA+D;QAC/D,EAAE;QACF,mBAAmB;QACnB,mBAAmB;QACnB,4BAA4B;QAC5B,8BAA8B;QAC9B,uCAAuC;QACvC,2BAA2B;QAC3B,EAAE;QACF,oBAAoB;QACpB,EAAE;QACF,mBAAmB;QACnB,mBAAmB;QACnB,wCAAwC;QACxC,+BAA+B;QAC/B,EAAE;QACF,iCAAiC;QACjC,iCAAiC;QACjC,4BAA4B;QAC5B,EAAE;QAEF,4DAA4D;QAC5D,sBAAsB;QACtB,EAAE;QACF,2FAA2F;QAC3F,EAAE;QACF,uBAAuB,EAAE,GAAG,UAAU,qEAAqE,EAAE,EAAE;QAC/G,oBAAoB,EAAE,GAAG,UAAU,uDAAuD,EAAE,EAAE;QAC9F,yBAAyB,EAAE,GAAG,UAAU,sDAAsD,EAAE,EAAE;QAClG,EAAE;QAEF,4DAA4D;QAC5D,qBAAqB;QACrB,EAAE;QACF,0FAA0F;QAC1F,EAAE;QACF,WAAW,EAAE,GAAG,UAAU,4DAA4D,EAAE,EAAE;QAC1F,uCAAuC;QACvC,qCAAqC;QACrC,EAAE;QACF,qBAAqB;QACrB,qBAAqB;QACrB,0DAA0D;QAC1D,yDAAyD;QACzD,oDAAoD;QACpD,uDAAuD;QACvD,wDAAwD;QACxD,mDAAmD;QACnD,EAAE;QAEF,4DAA4D;QAC5D,sBAAsB;QACtB,EAAE;QACF,sEAAsE;QACtE,mBAAmB,EAAE,GAAG,UAAU,qDAAqD,EAAE,EAAE;QAC3F,EAAE;QAEF,4DAA4D;QAC5D,kBAAkB;QAClB,EAAE;QACF,gFAAgF;QAChF,EAAE;QACF,YAAY,EAAE,GAAG,UAAU,uEAAuE,EAAE,EAAE;QACtG,eAAe,EAAE,GAAG,UAAU,wDAAwD,EAAE,EAAE;QAC1F,gBAAgB,EAAE,GAAG,UAAU,yDAAyD,EAAE,EAAE;QAC5F,EAAE;QACF,oGAAoG;QACpG,EAAE;KACH,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"shared-rules.js","sourceRoot":"","sources":["../../src/templates/shared-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAE5C,MAAM,UA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kCAAkC;IAClC,EAAE;IACF,4EAA4E;IAC5E,EAAE;IACF,qBAAqB;IACrB,qBAAqB;IACrB,0DAA0D;IAC1D,yDAAyD;IACzD,oDAAoD;IACpD,uDAAuD;IACvD,wDAAwD;IACxD,mDAAmD;IACnD,EAAE;IACF,iFAAiF;IACjF,EAAE;IAEF,4DAA4D;IAC5D,8BAA8B;IAC9B,iCAAiC;IACjC,EAAE;IACF,gHAAgH;IAChH,uHAAuH;IACvH,EAAE;IACF,mCAAmC;IACnC,oCAAoC;IACpC,2DAA2D;IAC3D,kDAAkD;IAClD,EAAE;IAEF,4DAA4D;IAC5D,wBAAwB;IACxB,uBAAuB;IACvB,EAAE;IACF,2GAA2G;IAC3G,6HAA6H;IAC7H,2FAA2F;IAC3F,EAAE;IAEF,4DAA4D;IAC5D,yBAAyB;IACzB,+BAA+B;IAC/B,EAAE;IACF,wFAAwF;IACxF,iFAAiF;IACjF,EAAE;IAEF,4DAA4D;IAC5D,sBAAsB;IACtB,yBAAyB;IACzB,EAAE;IACF,4BAA4B;IAC5B,EAAE;IACF,uBAAuB;IACvB,gEAAgE;IAChE,iGAAiG;IACjG,wEAAwE;IACxE,6DAA6D;IAC7D,wEAAwE;IACxE,EAAE;IACF,wBAAwB;IACxB,EAAE;IACF,yEAAyE;IACzE,gEAAgE;IAChE,EAAE;IAEF,SAAS,aAAa,MAAM;CAC7B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soleri/forge",
3
- "version": "5.13.1",
3
+ "version": "5.14.1",
4
4
  "description": "Scaffold AI agents that learn, remember, and grow with you.",
5
5
  "keywords": [
6
6
  "agent",
package/src/lib.ts CHANGED
@@ -21,3 +21,4 @@ export type {
21
21
  export { AgentConfigSchema, SETUP_TARGETS } from './types.js';
22
22
  export { generateExtensionsIndex, generateExampleOp } from './templates/extensions.js';
23
23
  export { generateClaudeMdTemplate } from './templates/claude-md-template.js';
24
+ export { getEngineRulesContent, getEngineMarker } from './templates/shared-rules.js';
@@ -1,18 +1,19 @@
1
1
  import type { AgentConfig } from '../types.js';
2
- import { getSharedRules } from './shared-rules.js';
2
+ import { getEngineMarker, getEngineRulesContent } from './shared-rules.js';
3
3
 
4
4
  /**
5
5
  * Generates src/activation/claude-md-content.ts for a new agent.
6
6
  *
7
- * Architecture:
8
- * 1. Agent-specific identity (persona, domains, principles)
9
- * 2. Session start protocol
10
- * 3. Curated facade table (~30 key ops, grouped by category)
11
- * 4. Shared behavioral rules (vault-first, planning, output formatting)
12
- * 5. Hook packs (conditional)
7
+ * Architecture (split injection):
8
+ * 1. Engine rules — shared, prefix-free, injected once under `<!-- soleri:engine-rules -->`
9
+ * 2. Agent block — lightweight, agent-specific, under `<!-- agent-id:mode -->`
10
+ * - Identity (persona, domains, principles)
11
+ * - Session start protocol
12
+ * - Curated facade table (~30 key ops, grouped by category)
13
+ * - Hook packs (conditional)
13
14
  *
14
- * Full op list is always available via `admin_tool_list` no need to
15
- * enumerate all 145+ ops in CLAUDE.md.
15
+ * The facade table maps `op:name` actual `agentId_core op:name` tool calls.
16
+ * Full op list is always available via `admin_tool_list`.
16
17
  */
17
18
  export function generateClaudeMdTemplate(config: AgentConfig): string {
18
19
  const toolPrefix = config.id;
@@ -54,87 +55,38 @@ export function generateClaudeMdTemplate(config: AgentConfig): string {
54
55
  '',
55
56
  ];
56
57
 
57
- // ─── Curated Facade Table ──────────────────────────────
58
+ // ─── Compact Facade Table ───────────────────────────────
58
59
  mdLines.push(
59
- '## Key Operations',
60
+ '## Essential Tools',
61
+ `<!-- ${toolPrefix}:tools -->`,
60
62
  '',
61
- `Full list: ${bt}${toolPrefix}_core op:admin_tool_list${bt}`,
62
- '',
63
- '| Need | Facade | Op |',
64
- '|------|--------|----|',
63
+ '| Facade | Key Ops |',
64
+ '|--------|---------|',
65
+ `| ${bt}${toolPrefix}_core${bt} | ${bt}health${bt}, ${bt}search${bt}, ${bt}identity${bt}, ${bt}register${bt}, ${bt}activate${bt} |`,
65
66
  );
66
67
 
67
- // Essential
68
- mdLines.push(
69
- `| Health check | ${bt}${toolPrefix}_core${bt} | ${bt}health${bt} |`,
70
- `| Search all | ${bt}${toolPrefix}_core${bt} | ${bt}search${bt} |`,
71
- `| Identity | ${bt}${toolPrefix}_core${bt} | ${bt}identity${bt} |`,
72
- );
73
-
74
- // Domain-specific (3 rows per domain)
68
+ // Domain facades — one row per domain
75
69
  for (const d of config.domains) {
76
70
  const toolName = `${toolPrefix}_${d.replace(/-/g, '_')}`;
77
71
  mdLines.push(
78
- `| ${d} patterns | ${bt}${toolName}${bt} | ${bt}get_patterns${bt} |`,
79
- `| Search ${d} | ${bt}${toolName}${bt} | ${bt}search${bt} |`,
80
- `| Capture ${d} | ${bt}${toolName}${bt} | ${bt}capture${bt} |`,
72
+ `| ${bt}${toolName}${bt} | ${bt}get_patterns${bt}, ${bt}search${bt}, ${bt}capture${bt} |`,
81
73
  );
82
74
  }
83
75
 
84
- // Knowledge & Search
85
- mdLines.push(
86
- `| Intelligent search | ${bt}${toolPrefix}_core${bt} | ${bt}search_intelligent${bt} |`,
87
- `| Quick capture | ${bt}${toolPrefix}_core${bt} | ${bt}capture_quick${bt} |`,
88
- `| Batch capture | ${bt}${toolPrefix}_core${bt} | ${bt}capture_knowledge${bt} |`,
89
- );
90
-
91
- // Memory
92
- mdLines.push(
93
- `| Memory search | ${bt}${toolPrefix}_core${bt} | ${bt}memory_search${bt} |`,
94
- `| Memory capture | ${bt}${toolPrefix}_core${bt} | ${bt}memory_capture${bt} |`,
95
- `| Session capture | ${bt}${toolPrefix}_core${bt} | ${bt}session_capture${bt} |`,
96
- );
97
-
98
- // Planning
99
- mdLines.push(
100
- `| Create plan | ${bt}${toolPrefix}_core${bt} | ${bt}create_plan${bt} |`,
101
- `| Approve plan | ${bt}${toolPrefix}_core${bt} | ${bt}approve_plan${bt} |`,
102
- `| Update task | ${bt}${toolPrefix}_core${bt} | ${bt}update_task${bt} |`,
103
- `| Complete plan | ${bt}${toolPrefix}_core${bt} | ${bt}complete_plan${bt} |`,
104
- );
105
-
106
- // Orchestration
107
- mdLines.push(
108
- `| Orchestrate plan | ${bt}${toolPrefix}_core${bt} | ${bt}orchestrate_plan${bt} |`,
109
- `| Orchestrate execute | ${bt}${toolPrefix}_core${bt} | ${bt}orchestrate_execute${bt} |`,
110
- `| Orchestrate complete | ${bt}${toolPrefix}_core${bt} | ${bt}orchestrate_complete${bt} |`,
111
- );
112
-
113
- // Brain & Control
114
- mdLines.push(
115
- `| Brain stats | ${bt}${toolPrefix}_core${bt} | ${bt}brain_stats${bt} |`,
116
- `| Brain feedback | ${bt}${toolPrefix}_core${bt} | ${bt}brain_feedback${bt} |`,
117
- `| Route intent | ${bt}${toolPrefix}_core${bt} | ${bt}route_intent${bt} |`,
118
- `| Get behavior rules | ${bt}${toolPrefix}_core${bt} | ${bt}get_behavior_rules${bt} |`,
119
- `| Morph mode | ${bt}${toolPrefix}_core${bt} | ${bt}morph${bt} |`,
120
- );
121
-
122
- // Admin
123
- mdLines.push(
124
- `| Admin health | ${bt}${toolPrefix}_core${bt} | ${bt}admin_health${bt} |`,
125
- `| Tool list | ${bt}${toolPrefix}_core${bt} | ${bt}admin_tool_list${bt} |`,
126
- );
127
-
128
- // Governance
76
+ // Engine facades — compact, grouped by concern
129
77
  mdLines.push(
130
- `| Governance dashboard | ${bt}${toolPrefix}_core${bt} | ${bt}governance_dashboard${bt} |`,
131
- `| Governance policy | ${bt}${toolPrefix}_core${bt} | ${bt}governance_policy${bt} |`,
78
+ `| ${bt}${toolPrefix}_core${bt} (vault) | ${bt}search_intelligent${bt}, ${bt}capture_knowledge${bt}, ${bt}capture_quick${bt}, ${bt}search_feedback${bt} |`,
79
+ `| ${bt}${toolPrefix}_core${bt} (memory) | ${bt}memory_search${bt}, ${bt}memory_capture${bt}, ${bt}session_capture${bt} |`,
80
+ `| ${bt}${toolPrefix}_core${bt} (planning) | ${bt}create_plan${bt}, ${bt}approve_plan${bt}, ${bt}plan_split${bt}, ${bt}plan_reconcile${bt}, ${bt}plan_complete_lifecycle${bt} |`,
81
+ `| ${bt}${toolPrefix}_core${bt} (orchestrate) | ${bt}orchestrate_plan${bt}, ${bt}orchestrate_execute${bt}, ${bt}orchestrate_complete${bt} |`,
82
+ `| ${bt}${toolPrefix}_core${bt} (brain) | ${bt}brain_stats${bt}, ${bt}brain_feedback${bt}, ${bt}rebuild_vocabulary${bt} |`,
83
+ `| ${bt}${toolPrefix}_core${bt} (control) | ${bt}route_intent${bt}, ${bt}morph${bt}, ${bt}get_behavior_rules${bt} |`,
84
+ `| ${bt}${toolPrefix}_core${bt} (loop) | ${bt}loop_start${bt}, ${bt}loop_iterate${bt}, ${bt}loop_status${bt}, ${bt}loop_cancel${bt} |`,
85
+ `| ${bt}${toolPrefix}_core${bt} (governance) | ${bt}governance_dashboard${bt}, ${bt}governance_policy${bt}, ${bt}governance_proposals${bt} |`,
86
+ `| ${bt}${toolPrefix}_core${bt} (admin) | ${bt}admin_health${bt}, ${bt}admin_tool_list${bt}, ${bt}admin_diagnostic${bt} |`,
132
87
  );
133
88
 
134
- mdLines.push('');
135
-
136
- // ─── Shared Behavioral Rules ───────────────────────────
137
- mdLines.push(...getSharedRules(toolPrefix));
89
+ mdLines.push('', `> Full list: ${bt}${toolPrefix}_core op:admin_tool_list${bt}`, '');
138
90
 
139
91
  // ─── Hook Packs (conditional) ──────────────────────────
140
92
  appendHookPacks(mdLines, config);
@@ -148,11 +100,20 @@ export function generateClaudeMdTemplate(config: AgentConfig): string {
148
100
  return ` '${escaped}',`;
149
101
  });
150
102
 
103
+ // Generate engine rules as a quoted string literal
104
+ const engineContent = getEngineRulesContent();
105
+ const engineQuotedLines = engineContent.split('\n').map((line) => {
106
+ const escaped = line.replace(/\\/g, '\\\\').replace(/'/g, "\\'");
107
+ return ` '${escaped}',`;
108
+ });
109
+
151
110
  return [
152
111
  '/**',
153
112
  ` * CLAUDE.md content for ${config.name}.`,
154
113
  ' * Generated by Soleri — do not edit manually.',
155
114
  ' */',
115
+ '',
116
+ '/** Agent-specific block (identity + activation + facade table). */',
156
117
  'export function getClaudeMdContent(): string {',
157
118
  ' return [',
158
119
  ...quotedLines,
@@ -162,6 +123,17 @@ export function generateClaudeMdTemplate(config: AgentConfig): string {
162
123
  'export function getClaudeMdMarker(): string {',
163
124
  ` return '${marker}';`,
164
125
  '}',
126
+ '',
127
+ '/** Shared engine rules — injected once, skipped if already present. */',
128
+ 'export function getEngineRulesContent(): string {',
129
+ ' return [',
130
+ ...engineQuotedLines,
131
+ " ].join('\\n');",
132
+ '}',
133
+ '',
134
+ 'export function getEngineRulesMarker(): string {',
135
+ ` return '${getEngineMarker()}';`,
136
+ '}',
165
137
  ].join('\n');
166
138
  }
167
139