@soleri/forge 9.8.0 → 9.10.0
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.
- package/dist/agent-schema.d.ts +11 -0
- package/dist/agent-schema.js +8 -0
- package/dist/agent-schema.js.map +1 -1
- package/dist/compose-claude-md.d.ts +11 -0
- package/dist/compose-claude-md.js +104 -0
- package/dist/compose-claude-md.js.map +1 -1
- package/dist/lib.d.ts +2 -1
- package/dist/lib.js +1 -1
- package/dist/lib.js.map +1 -1
- package/dist/scaffold-filetree.js +28 -11
- package/dist/scaffold-filetree.js.map +1 -1
- package/dist/skills/subagent-driven-development/SKILL.md +87 -20
- package/dist/templates/inject-claude-md.js +50 -5
- package/dist/templates/inject-claude-md.js.map +1 -1
- package/dist/templates/section-parser.d.ts +33 -0
- package/dist/templates/section-parser.js +75 -0
- package/dist/templates/section-parser.js.map +1 -0
- package/dist/templates/shared-rules.d.ts +14 -0
- package/dist/templates/shared-rules.js +192 -11
- package/dist/templates/shared-rules.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/compose-claude-md.test.ts +89 -0
- package/src/__tests__/scaffold-filetree.test.ts +93 -0
- package/src/__tests__/scaffolder.test.ts +7 -5
- package/src/__tests__/shared-rules.test.ts +99 -1
- package/src/agent-schema.ts +8 -0
- package/src/compose-claude-md.ts +124 -0
- package/src/lib.ts +7 -1
- package/src/scaffold-filetree.ts +34 -11
- package/src/skills/subagent-driven-development/SKILL.md +87 -20
- package/src/templates/inject-claude-md.ts +50 -5
- package/src/templates/section-parser.ts +97 -0
- package/src/templates/shared-rules.ts +203 -11
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* Uses op:name syntax — the active agent provides the tool prefix.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
import { parseSections, filterSections } from './section-parser.js';
|
|
13
|
+
|
|
12
14
|
const ENGINE_MARKER = 'soleri:engine-rules';
|
|
13
15
|
|
|
14
16
|
export function getEngineMarker(): string {
|
|
@@ -20,6 +22,83 @@ export function getEngineRulesContent(): string {
|
|
|
20
22
|
return ENGINE_RULES_LINES.join('\n');
|
|
21
23
|
}
|
|
22
24
|
|
|
25
|
+
// ─── Modular Engine Rules ────────────────────────────────────────────
|
|
26
|
+
|
|
27
|
+
/** Feature modules that can be selectively included in engine rules. */
|
|
28
|
+
export type EngineFeature = 'vault' | 'planning' | 'brain' | 'advanced';
|
|
29
|
+
|
|
30
|
+
/** All available feature modules. */
|
|
31
|
+
export const ENGINE_FEATURES: readonly EngineFeature[] = [
|
|
32
|
+
'vault',
|
|
33
|
+
'planning',
|
|
34
|
+
'brain',
|
|
35
|
+
'advanced',
|
|
36
|
+
] as const;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Section markers grouped by module.
|
|
40
|
+
*
|
|
41
|
+
* 'core' sections are always included.
|
|
42
|
+
* Feature modules are included only when requested (or when no filter is specified).
|
|
43
|
+
*/
|
|
44
|
+
const MODULE_SECTIONS: Record<'core' | EngineFeature, readonly string[]> = {
|
|
45
|
+
core: [
|
|
46
|
+
'soleri:what-is-soleri',
|
|
47
|
+
'soleri:response-integrity',
|
|
48
|
+
'soleri:tool-schema-validation',
|
|
49
|
+
'soleri:memory-quality',
|
|
50
|
+
'soleri:output-formatting',
|
|
51
|
+
'soleri:clean-commits',
|
|
52
|
+
'soleri:intent-detection',
|
|
53
|
+
'soleri:overlay-mode',
|
|
54
|
+
'soleri:session',
|
|
55
|
+
'soleri:getting-started',
|
|
56
|
+
'soleri:cli',
|
|
57
|
+
'soleri:persona-self-update',
|
|
58
|
+
'soleri:workspace-routing',
|
|
59
|
+
],
|
|
60
|
+
vault: [
|
|
61
|
+
'soleri:vault-protocol',
|
|
62
|
+
'soleri:knowledge-capture',
|
|
63
|
+
'soleri:tool-advocacy',
|
|
64
|
+
'soleri:cross-project',
|
|
65
|
+
],
|
|
66
|
+
planning: [
|
|
67
|
+
'soleri:planning',
|
|
68
|
+
'soleri:workflow-overrides',
|
|
69
|
+
'soleri:yolo-mode',
|
|
70
|
+
'soleri:task-routing',
|
|
71
|
+
'soleri:validation-loop',
|
|
72
|
+
'soleri:verification-protocol',
|
|
73
|
+
],
|
|
74
|
+
brain: ['soleri:brain', 'soleri:model-routing'],
|
|
75
|
+
advanced: ['soleri:subagent-identity'],
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Returns engine rules with only selected feature modules included.
|
|
80
|
+
*
|
|
81
|
+
* Core rules are ALWAYS included. Feature modules are included when:
|
|
82
|
+
* - `features` is undefined/empty → ALL modules included (backward compatible)
|
|
83
|
+
* - `features` is specified → only listed modules + core
|
|
84
|
+
*
|
|
85
|
+
* @param features - Feature modules to include. Omit for all.
|
|
86
|
+
*/
|
|
87
|
+
export function getModularEngineRules(features?: EngineFeature[]): string {
|
|
88
|
+
if (!features || features.length === 0) {
|
|
89
|
+
return getEngineRulesContent();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const allowedMarkers = new Set<string>(MODULE_SECTIONS.core);
|
|
93
|
+
for (const feature of features) {
|
|
94
|
+
const sections = MODULE_SECTIONS[feature];
|
|
95
|
+
if (sections) for (const m of sections) allowedMarkers.add(m);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const parsed = parseSections(getEngineRulesContent());
|
|
99
|
+
return filterSections(parsed, allowedMarkers);
|
|
100
|
+
}
|
|
101
|
+
|
|
23
102
|
const ENGINE_RULES_LINES: string[] = [
|
|
24
103
|
`<!-- ${ENGINE_MARKER} -->`,
|
|
25
104
|
'',
|
|
@@ -223,6 +302,42 @@ const ENGINE_RULES_LINES: string[] = [
|
|
|
223
302
|
'```',
|
|
224
303
|
'',
|
|
225
304
|
|
|
305
|
+
// ─── Workflow Overrides ──────────────────────────────────
|
|
306
|
+
'## Workflow Overrides',
|
|
307
|
+
'<!-- soleri:workflow-overrides -->',
|
|
308
|
+
'',
|
|
309
|
+
"The engine reads `gates.yaml` and `tools.yaml` from your agent's `workflows/` directory and merges them into plans.",
|
|
310
|
+
'',
|
|
311
|
+
'**Three files, three purposes:**',
|
|
312
|
+
'- `prompt.md` — Claude reads this as narrative guidance (what to do)',
|
|
313
|
+
'- `gates.yaml` — Engine enforces these as plan checkpoints (when to validate)',
|
|
314
|
+
'- `tools.yaml` — Engine merges these into plan steps (what tools to use)',
|
|
315
|
+
'',
|
|
316
|
+
'**Default mapping** (workflow name → orchestration intent):',
|
|
317
|
+
'| Workflow | Intent |',
|
|
318
|
+
'|----------|--------|',
|
|
319
|
+
'| `feature-dev` | BUILD |',
|
|
320
|
+
'| `bug-fix` | FIX |',
|
|
321
|
+
'| `code-review` | REVIEW |',
|
|
322
|
+
'| `context-handoff` | HANDOFF |',
|
|
323
|
+
'',
|
|
324
|
+
'Override in `agent.yaml`:',
|
|
325
|
+
'```yaml',
|
|
326
|
+
'workflowIntents:',
|
|
327
|
+
' my-custom-workflow: BUILD',
|
|
328
|
+
' security-review: REVIEW',
|
|
329
|
+
'```',
|
|
330
|
+
'',
|
|
331
|
+
'**How it works:**',
|
|
332
|
+
'1. You call `orchestrate_plan` with a task',
|
|
333
|
+
'2. Engine detects intent (e.g., REVIEW)',
|
|
334
|
+
'3. Engine checks if your agent has a matching workflow (e.g., `workflows/code-review/`)',
|
|
335
|
+
'4. If found: workflow gates are appended to plan gates, workflow tools are merged into plan steps',
|
|
336
|
+
'5. If not found: current behavior unchanged',
|
|
337
|
+
'',
|
|
338
|
+
'**Editing workflows changes engine behavior.** If you modify `gates.yaml` in `workflows/code-review/`, the next REVIEW plan will include your custom gates.',
|
|
339
|
+
'',
|
|
340
|
+
|
|
226
341
|
// ─── YOLO Mode ──────────────────────────────────────────
|
|
227
342
|
'## YOLO Mode',
|
|
228
343
|
'<!-- soleri:yolo-mode -->',
|
|
@@ -606,6 +721,17 @@ const ENGINE_RULES_LINES: string[] = [
|
|
|
606
721
|
'The scaffolded agent is ready immediately — no build step, no npm install for the agent itself.',
|
|
607
722
|
'Git is initialized by default (`git init` + initial commit). Use `--no-git` to skip. After scaffolding, the CLI offers to set up a remote via `gh repo create` (if gh CLI is available) or a manual remote URL. The `--yes` flag enables git init but skips the remote prompt.',
|
|
608
723
|
'',
|
|
724
|
+
'### Browsable Knowledge',
|
|
725
|
+
'',
|
|
726
|
+
"Your agent's vault is automatically synced to `knowledge/vault/` as markdown files. Browse them in VS Code, Obsidian, or any editor.",
|
|
727
|
+
'',
|
|
728
|
+
'```bash',
|
|
729
|
+
'# Export vault to a custom location (e.g., Obsidian)',
|
|
730
|
+
'soleri vault export --path ~/obsidian-vault/soleri',
|
|
731
|
+
'```',
|
|
732
|
+
'',
|
|
733
|
+
'The engine indexes entries in SQLite for fast search, but you always own the files.',
|
|
734
|
+
'',
|
|
609
735
|
'### Updating Soleri',
|
|
610
736
|
'',
|
|
611
737
|
'| What to update | Command |',
|
|
@@ -636,28 +762,28 @@ const ENGINE_RULES_LINES: string[] = [
|
|
|
636
762
|
'',
|
|
637
763
|
'### How Your CLAUDE.md is Built',
|
|
638
764
|
'',
|
|
639
|
-
'Your CLAUDE.md is **auto-generated** — never edit it manually
|
|
640
|
-
'',
|
|
641
|
-
'| Trigger | How |',
|
|
642
|
-
'|---------|-----|',
|
|
643
|
-
'| `soleri dev` | Hot-reloads and regenerates on file changes |',
|
|
644
|
-
'| `soleri agent refresh` | Explicitly regenerates from latest templates |',
|
|
645
|
-
'| `soleri agent update` | After engine update, regenerates to pick up new rules |',
|
|
646
|
-
'| Scaffold (`create-soleri`) | Generates initial CLAUDE.md for new agents |',
|
|
765
|
+
'Your CLAUDE.md is **auto-generated** — never edit it manually (except inside `<!-- user:custom -->` markers). Regenerated by `soleri dev`, `soleri agent refresh`, `soleri agent update`, and on scaffold.',
|
|
647
766
|
'',
|
|
648
767
|
'The composition pipeline assembles CLAUDE.md from:',
|
|
649
768
|
'',
|
|
650
769
|
'1. **Agent identity** — from `agent.yaml`',
|
|
651
770
|
'2. **Custom instructions** — from `instructions/user.md` (priority placement, before engine rules)',
|
|
652
|
-
'3. **Engine rules** —
|
|
771
|
+
'3. **Engine rules** — modular, controlled by `engine.features` in `agent.yaml`',
|
|
653
772
|
'4. **User instructions** — from `instructions/*.md` (alphabetically sorted, excluding `user.md` and `_engine.md`)',
|
|
654
773
|
'5. **Tools table** — from engine registration',
|
|
655
774
|
'6. **Workflow index** — from `workflows/`',
|
|
656
775
|
'7. **Skills index** — from `skills/`',
|
|
657
776
|
'',
|
|
658
|
-
'`
|
|
777
|
+
'**Modular engine rules:** The `engine.features` array in `agent.yaml` controls which rule modules are included. Available: `vault`, `planning`, `brain`, `advanced`. Core rules are always included. Default (no features specified) = all modules.',
|
|
778
|
+
'',
|
|
779
|
+
'### What Survives Regeneration',
|
|
659
780
|
'',
|
|
660
|
-
'
|
|
781
|
+
'| Source | Survives? |',
|
|
782
|
+
'|--------|-----------|',
|
|
783
|
+
'| `instructions/*.md` | Yes — re-read on every regen |',
|
|
784
|
+
'| `<!-- user:custom -->` zone in CLAUDE.md | Yes — extracted and re-injected |',
|
|
785
|
+
'| `agent.yaml` | Drives regen (source of truth) |',
|
|
786
|
+
'| Manual CLAUDE.md edits outside markers | No — overwritten, warning logged |',
|
|
661
787
|
'',
|
|
662
788
|
'### System Requirements',
|
|
663
789
|
'',
|
|
@@ -684,6 +810,14 @@ const ENGINE_RULES_LINES: string[] = [
|
|
|
684
810
|
'| `soleri dev` | Run agent in development mode (stdio MCP) |',
|
|
685
811
|
'| `soleri test` | Run agent tests (`--watch`, `--coverage`) |',
|
|
686
812
|
'',
|
|
813
|
+
'### Vault',
|
|
814
|
+
'',
|
|
815
|
+
'| Command | What it does |',
|
|
816
|
+
'|---------|-------------|',
|
|
817
|
+
'| `soleri vault export` | Export vault entries as browsable markdown files |',
|
|
818
|
+
'| `soleri vault export --path <dir>` | Export to custom directory (e.g., Obsidian vault) |',
|
|
819
|
+
'| `soleri vault export --domain <name>` | Export entries from a specific domain |',
|
|
820
|
+
'',
|
|
687
821
|
'### Knowledge & Packs',
|
|
688
822
|
'',
|
|
689
823
|
'| Command | What it does |',
|
|
@@ -822,5 +956,63 @@ const ENGINE_RULES_LINES: string[] = [
|
|
|
822
956
|
'- Advisory only — flags warnings, never blocks execution',
|
|
823
957
|
'',
|
|
824
958
|
|
|
959
|
+
// ─── Subagent Identity & Behavioral Contract ──────────────
|
|
960
|
+
'## Subagent Identity & Behavioral Contract',
|
|
961
|
+
'<!-- soleri:subagent-identity -->',
|
|
962
|
+
'',
|
|
963
|
+
'When the orchestrator fans out work to subagents, two agent types are available. The orchestrator routes based on task complexity.',
|
|
964
|
+
'',
|
|
965
|
+
'### Agent Types',
|
|
966
|
+
'',
|
|
967
|
+
'| Type | When to use | Capabilities | Overhead |',
|
|
968
|
+
'|------|------------|--------------|----------|',
|
|
969
|
+
'| **Claude Code worker** | Mechanical tasks: single-file edits, test fixes, config changes, clear specs | File read/write/edit, git, shell, tests | Low — fast, stateless |',
|
|
970
|
+
'| **Soleri agent instance** | Complex tasks: design decisions, multi-file with cross-cutting concerns, new dependencies | Full agent lifecycle: vault, brain, planning, knowledge capture | High — full activation cycle |',
|
|
971
|
+
'',
|
|
972
|
+
'### Routing Table',
|
|
973
|
+
'',
|
|
974
|
+
'| Signal | Route to |',
|
|
975
|
+
'|--------|---------|',
|
|
976
|
+
'| Single file, clear acceptance criteria, spec fully decided | Claude Code worker |',
|
|
977
|
+
'| Approach already described in parent plan | Claude Code worker |',
|
|
978
|
+
'| Touches 3+ files with cross-cutting concerns | Soleri agent instance |',
|
|
979
|
+
'| Unresolved design decisions not in parent plan | Soleri agent instance |',
|
|
980
|
+
'| New dependencies or architectural choices needed | Soleri agent instance |',
|
|
981
|
+
'',
|
|
982
|
+
'### The Rules',
|
|
983
|
+
'',
|
|
984
|
+
'1. **Orchestrator owns all decisions.** Subagents execute specs — they do NOT make design decisions. If a subagent encounters ambiguity, it returns to the orchestrator with a question, not a guess.',
|
|
985
|
+
'2. **Subagents MUST NOT create plans.** Only the parent orchestrator creates plans. Subagents receive task prompts with exact scope, file boundaries, and acceptance criteria. They execute and return results.',
|
|
986
|
+
'3. **Worktree cleanup is guaranteed.** Three-layer defense: (a) `finally` block in dispatcher cleans per-task worktree, (b) `cleanupAll()` runs after batch completion, (c) `SessionStart` hook prunes orphaned worktrees on every session.',
|
|
987
|
+
'4. **Escalation protocol.** When a subagent hits ambiguity or a blocking issue, it MUST return to the orchestrator with a clear description of the blocker. The orchestrator decides — ask the user or resolve — then re-dispatches.',
|
|
988
|
+
'5. **No freelancing.** Subagents stay within their assigned file boundaries and acceptance criteria. No "while I\'m here" improvements, no scope creep, no out-of-scope commits.',
|
|
989
|
+
'6. **UX output contract.** The orchestrator communicates subagent work to the user at three verbosity levels:',
|
|
990
|
+
'',
|
|
991
|
+
'### UX Output Format',
|
|
992
|
+
'',
|
|
993
|
+
'**Minimal (default):**',
|
|
994
|
+
'```',
|
|
995
|
+
'Dispatching N tasks in parallel...',
|
|
996
|
+
'',
|
|
997
|
+
'✓ N/N complete. M patterns captured to vault.',
|
|
998
|
+
' → Decisions: [list any design decisions made]',
|
|
999
|
+
'```',
|
|
1000
|
+
'',
|
|
1001
|
+
'**Detailed (on request or for complex work):**',
|
|
1002
|
+
'```',
|
|
1003
|
+
'| # | Task | Agent | Status | Knowledge |',
|
|
1004
|
+
'|---|------|-------|--------|-----------|',
|
|
1005
|
+
'| 1 | Description | Worker/Instance | Done ✓ | — |',
|
|
1006
|
+
'```',
|
|
1007
|
+
'',
|
|
1008
|
+
'**Verbose (debugging):** Full lifecycle state, vault entries, plan IDs.',
|
|
1009
|
+
'',
|
|
1010
|
+
'### User Overrides',
|
|
1011
|
+
'',
|
|
1012
|
+
'- "Use full agent for everything" → all subagents are Soleri agent instances',
|
|
1013
|
+
'- "Just use workers" → all subagents are Claude Code workers (no lifecycle overhead)',
|
|
1014
|
+
'- Default: hybrid routing based on complexity',
|
|
1015
|
+
'',
|
|
1016
|
+
|
|
825
1017
|
`<!-- /${ENGINE_MARKER} -->`,
|
|
826
1018
|
];
|