kairn-cli 1.10.1 → 1.11.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/cli.js CHANGED
@@ -487,7 +487,7 @@ You must output a JSON object matching the SkeletonSpec schema.
487
487
 
488
488
  - MCP servers: maximum 6. Prefer fewer.
489
489
  - Skills: maximum 3. Only include directly relevant ones.
490
- - Agents: maximum 3. QA pipeline + one specialist.
490
+ - Agents: maximum 5. Orchestration pipeline (/develop) agents.
491
491
  - Hooks: maximum 4 (auto-format, block-destructive, PostCompact, plus one contextual).
492
492
 
493
493
  If the workflow doesn't clearly need a tool, DO NOT include it.
@@ -527,12 +527,12 @@ You must generate all harness content: CLAUDE.md, commands, rules, agents, skill
527
527
  ## Core Principles
528
528
 
529
529
  - **Workflow-specific, not generic.** Every instruction, command, and rule must relate to the user's actual workflow.
530
- - **Concise CLAUDE.md.** Under 120 lines. No generic text like "be helpful." Include build/test commands, reference docs/ and skills/.
530
+ - **Concise CLAUDE.md.** Under 150 lines. No generic text like "be helpful." Include build/test commands, reference docs/ and skills/.
531
531
  - **Security by default.** Always include deny rules for destructive commands and secret file access.
532
532
 
533
533
  ## CLAUDE.md Template (mandatory structure)
534
534
 
535
- The \`claude_md\` field MUST follow this exact structure (max 120 lines):
535
+ The \`claude_md\` field MUST follow this exact structure (max 150 lines):
536
536
 
537
537
  \`\`\`
538
538
  # {Project Name}
@@ -581,6 +581,25 @@ Use subagents for deep investigation to keep main context clean.
581
581
  - Prefer small, focused commits (one feature or fix per commit)
582
582
  - Use conventional commits: feat:, fix:, docs:, refactor:, test:
583
583
  - Target < 200 lines per PR when possible
584
+
585
+ ## Engineering Standards
586
+ - Lead with answers over reasoning. Be concise.
587
+ - Use absolute file paths in all references.
588
+ - No filler, no inner monologue, no time estimates.
589
+ - Produce load-bearing code \u2014 every line of output should be actionable.
590
+
591
+ ## Tool Usage Policy
592
+ - Prefer Edit tool over sed/awk for file modifications
593
+ - Prefer Grep tool over rg for searching
594
+ - Prefer Read tool over cat for file reading
595
+ - Reserve Bash for: builds, installs, git, network, processes
596
+ - Read and understand existing code before modifying
597
+ - Delete unused code completely \u2014 no compatibility shims
598
+
599
+ ## Code Philosophy
600
+ - Do not create abstractions for one-time operations
601
+ - Complete the task fully \u2014 don't gold-plate, but don't leave it half-done
602
+ - Prefer editing existing files over creating new ones
584
603
  \`\`\`
585
604
 
586
605
  Do not add generic filler. Every line must be specific to the user's workflow.
@@ -589,20 +608,19 @@ Do not add generic filler. Every line must be specific to the user's workflow.
589
608
 
590
609
  1. A concise, workflow-specific \`claude_md\` (the CLAUDE.md content)
591
610
  2. A \`/project:help\` command that explains the environment
592
- 3. A \`/project:tasks\` command for task management via TODO.md
593
- 4. A \`docs/TODO.md\` file for continuity
594
- 5. A \`docs/DECISIONS.md\` file for architectural decisions
595
- 6. A \`docs/LEARNINGS.md\` file for non-obvious discoveries
596
- 7. A \`rules/continuity.md\` rule encouraging updates to DECISIONS.md and LEARNINGS.md
597
- 8. A \`rules/security.md\` rule with essential security instructions
598
- 9. settings.json with deny rules for \`rm -rf\`, \`curl|sh\`, reading \`.env\` and \`secrets/\`
599
- 10. A \`/project:status\` command for code projects (uses ! for live git/test output)
600
- 11. A \`/project:fix\` command for code projects (uses $ARGUMENTS for issue number)
601
- 12. A \`docs/SPRINT.md\` file for sprint contracts (acceptance criteria, verification steps)
602
- 13. A "Verification" section in CLAUDE.md with concrete verify commands for the project
603
- 14. A "Known Gotchas" section in CLAUDE.md (starts empty, grows with corrections)
604
- 15. A "Debugging" section in CLAUDE.md (2 lines: paste raw errors, use subagents)
605
- 16. A "Git Workflow" section in CLAUDE.md (3 rules: small commits, conventional format, <200 lines PR)
611
+ 3. A \`docs/DECISIONS.md\` file for architectural decisions
612
+ 4. A \`docs/LEARNINGS.md\` file for non-obvious discoveries
613
+ 5. A \`rules/continuity.md\` rule encouraging updates to DECISIONS.md and LEARNINGS.md
614
+ 6. A \`rules/security.md\` rule with essential security instructions
615
+ 7. settings.json with deny rules for \`rm -rf\`, \`curl|sh\`, reading \`.env\` and \`secrets/\`
616
+ 8. A \`/project:status\` command for code projects (uses ! for live git/SPRINT.md output)
617
+ 9. A \`/project:fix\` command for code projects (uses $ARGUMENTS for issue number)
618
+ 10. A \`docs/SPRINT.md\` file as the living spec/plan (replaces TODO.md \u2014 acceptance criteria, verification steps)
619
+ 11. A "Verification" section in CLAUDE.md with concrete verify commands for the project
620
+ 12. A "Known Gotchas" section in CLAUDE.md (starts empty, grows with corrections)
621
+ 13. A "Debugging" section in CLAUDE.md (2 lines: paste raw errors, use subagents)
622
+ 14. A "Git Workflow" section in CLAUDE.md (3 rules: small commits, conventional format, <200 lines PR)
623
+ 15. "Engineering Standards", "Tool Usage Policy", and "Code Philosophy" sections in CLAUDE.md
606
624
 
607
625
  ## Shell-Integrated Commands
608
626
 
@@ -717,9 +735,10 @@ Merge this into the settings hooks alongside the PreToolUse and PostToolUse hook
717
735
  - \`/project:review\` command (review changes)
718
736
  - \`/project:test\` command (run and fix tests)
719
737
  - \`/project:commit\` command (conventional commits)
720
- - \`/project:status\` command (live git status, recent commits, TODO overview using ! prefix)
738
+ - \`/project:status\` command (live git status, recent commits, SPRINT.md overview using ! prefix)
721
739
  - \`/project:fix\` command (takes $ARGUMENTS as issue number, plans fix, implements, tests, commits)
722
740
  - \`/project:sprint\` command (define acceptance criteria before coding, writes to docs/SPRINT.md)
741
+ - \`/project:develop\` command (full development pipeline \u2014 orchestrates @architect \u2192 @planner \u2192 @implementer \u2192 @verifier \u2192 @fixer \u2192 @grill \u2192 @doc-updater through spec, plan, TDD implement, review, and doc update phases)
723
742
  - A TDD skill using the 3-phase isolation pattern (RED \u2192 GREEN \u2192 REFACTOR):
724
743
  - RED: Write failing test only. Verify it FAILS.
725
744
  - GREEN: Write MINIMUM code to pass. Nothing extra.
@@ -729,6 +748,12 @@ Merge this into the settings hooks alongside the PreToolUse and PostToolUse hook
729
748
  - \`@qa-orchestrator\` (sonnet) \u2014 delegates to linter and e2e-tester, compiles QA report
730
749
  - \`@linter\` (haiku) \u2014 runs formatters, linters, security scanners
731
750
  - \`@e2e-tester\` (sonnet, only when Playwright is in tools) \u2014 browser-based QA via Playwright
751
+ - Development pipeline agents (used by /project:develop):
752
+ - \`@architect\` (opus) \u2014 conducts spec interview with user, writes confirmed spec to docs/SPRINT.md
753
+ - \`@planner\` (opus) \u2014 reads spec and codebase, creates step-by-step implementation plan in docs/PLAN.md
754
+ - \`@implementer\` (sonnet) \u2014 TDD-focused implementation, writes failing tests then minimum code to pass
755
+ - \`@fixer\` (sonnet) \u2014 targeted bug fixing from verifier/review feedback
756
+ - \`@doc-updater\` (haiku) \u2014 extracts decisions and learnings from completed work, updates docs/DECISIONS.md and docs/LEARNINGS.md
732
757
  - \`/project:spec\` command (interview-based spec creation \u2014 asks 5-8 questions one at a time, writes structured spec to docs/SPRINT.md, does NOT start coding until confirmed)
733
758
  - \`/project:prove\` command (runs tests, shows git diff vs main, rates confidence HIGH/MEDIUM/LOW with evidence)
734
759
  - \`/project:grill\` command (adversarial code review \u2014 challenges each change with "why this approach?", "what if X input?", rates BLOCKER/SHOULD-FIX/NITPICK, blocks until BLOCKERs resolved)
@@ -776,12 +801,12 @@ Return ONLY valid JSON matching this structure:
776
801
 
777
802
  \`\`\`json
778
803
  {
779
- "claude_md": "Full CLAUDE.md content (under 120 lines)",
780
- "commands": { "help": "...", "tasks": "...", "status": "...", "fix": "...", "sprint": "...", "spec": "...", "prove": "...", "grill": "...", "reset": "..." },
804
+ "claude_md": "Full CLAUDE.md content (under 150 lines)",
805
+ "commands": { "help": "...", "develop": "...", "status": "...", "fix": "...", "sprint": "...", "spec": "...", "prove": "...", "grill": "...", "reset": "..." },
781
806
  "rules": { "continuity": "...", "security": "..." },
782
- "agents": { "qa-orchestrator": "...", "linter": "...", "e2e-tester": "..." },
807
+ "agents": { "architect": "...", "planner": "...", "implementer": "...", "fixer": "...", "doc-updater": "...", "qa-orchestrator": "...", "linter": "...", "e2e-tester": "..." },
783
808
  "skills": { "skill-name/SKILL": "..." },
784
- "docs": { "TODO": "...", "DECISIONS": "...", "LEARNINGS": "...", "SPRINT": "..." }
809
+ "docs": { "DECISIONS": "...", "LEARNINGS": "...", "SPRINT": "..." }
785
810
  }
786
811
  \`\`\`
787
812
 
@@ -798,12 +823,12 @@ You must output a JSON object matching the EnvironmentSpec schema.
798
823
 
799
824
  - **Minimalism over completeness.** Fewer, well-chosen tools beat many generic ones. Each MCP server costs 500-2000 context tokens.
800
825
  - **Workflow-specific, not generic.** Every instruction, command, and rule must relate to the user's actual workflow.
801
- - **Concise CLAUDE.md.** Under 120 lines. No generic text like "be helpful." Include build/test commands, reference docs/ and skills/.
826
+ - **Concise CLAUDE.md.** Under 150 lines. No generic text like "be helpful." Include build/test commands, reference docs/ and skills/.
802
827
  - **Security by default.** Always include deny rules for destructive commands and secret file access.
803
828
 
804
829
  ## CLAUDE.md Template (mandatory structure)
805
830
 
806
- The \`claude_md\` field MUST follow this exact structure (max 120 lines):
831
+ The \`claude_md\` field MUST follow this exact structure (max 150 lines):
807
832
 
808
833
  \`\`\`
809
834
  # {Project Name}
@@ -852,6 +877,25 @@ Use subagents for deep investigation to keep main context clean.
852
877
  - Prefer small, focused commits (one feature or fix per commit)
853
878
  - Use conventional commits: feat:, fix:, docs:, refactor:, test:
854
879
  - Target < 200 lines per PR when possible
880
+
881
+ ## Engineering Standards
882
+ - Lead with answers over reasoning. Be concise.
883
+ - Use absolute file paths in all references.
884
+ - No filler, no inner monologue, no time estimates.
885
+ - Produce load-bearing code \u2014 every line of output should be actionable.
886
+
887
+ ## Tool Usage Policy
888
+ - Prefer Edit tool over sed/awk for file modifications
889
+ - Prefer Grep tool over rg for searching
890
+ - Prefer Read tool over cat for file reading
891
+ - Reserve Bash for: builds, installs, git, network, processes
892
+ - Read and understand existing code before modifying
893
+ - Delete unused code completely \u2014 no compatibility shims
894
+
895
+ ## Code Philosophy
896
+ - Do not create abstractions for one-time operations
897
+ - Complete the task fully \u2014 don't gold-plate, but don't leave it half-done
898
+ - Prefer editing existing files over creating new ones
855
899
  \`\`\`
856
900
 
857
901
  Do not add generic filler. Every line must be specific to the user's workflow.
@@ -860,20 +904,19 @@ Do not add generic filler. Every line must be specific to the user's workflow.
860
904
 
861
905
  1. A concise, workflow-specific \`claude_md\` (the CLAUDE.md content)
862
906
  2. A \`/project:help\` command that explains the environment
863
- 3. A \`/project:tasks\` command for task management via TODO.md
864
- 4. A \`docs/TODO.md\` file for continuity
865
- 5. A \`docs/DECISIONS.md\` file for architectural decisions
866
- 6. A \`docs/LEARNINGS.md\` file for non-obvious discoveries
867
- 7. A \`rules/continuity.md\` rule encouraging updates to DECISIONS.md and LEARNINGS.md
868
- 8. A \`rules/security.md\` rule with essential security instructions
869
- 9. settings.json with deny rules for \`rm -rf\`, \`curl|sh\`, reading \`.env\` and \`secrets/\`
870
- 10. A \`/project:status\` command for code projects (uses ! for live git/test output)
871
- 11. A \`/project:fix\` command for code projects (uses $ARGUMENTS for issue number)
872
- 12. A \`docs/SPRINT.md\` file for sprint contracts (acceptance criteria, verification steps)
873
- 13. A "Verification" section in CLAUDE.md with concrete verify commands for the project
874
- 14. A "Known Gotchas" section in CLAUDE.md (starts empty, grows with corrections)
875
- 15. A "Debugging" section in CLAUDE.md (2 lines: paste raw errors, use subagents)
876
- 16. A "Git Workflow" section in CLAUDE.md (3 rules: small commits, conventional format, <200 lines PR)
907
+ 3. A \`docs/DECISIONS.md\` file for architectural decisions
908
+ 4. A \`docs/LEARNINGS.md\` file for non-obvious discoveries
909
+ 5. A \`rules/continuity.md\` rule encouraging updates to DECISIONS.md and LEARNINGS.md
910
+ 6. A \`rules/security.md\` rule with essential security instructions
911
+ 7. settings.json with deny rules for \`rm -rf\`, \`curl|sh\`, reading \`.env\` and \`secrets/\`
912
+ 8. A \`/project:status\` command for code projects (uses ! for live git/SPRINT.md output)
913
+ 9. A \`/project:fix\` command for code projects (uses $ARGUMENTS for issue number)
914
+ 10. A \`docs/SPRINT.md\` file as the living spec/plan (replaces TODO.md \u2014 acceptance criteria, verification steps)
915
+ 11. A "Verification" section in CLAUDE.md with concrete verify commands for the project
916
+ 12. A "Known Gotchas" section in CLAUDE.md (starts empty, grows with corrections)
917
+ 13. A "Debugging" section in CLAUDE.md (2 lines: paste raw errors, use subagents)
918
+ 14. A "Git Workflow" section in CLAUDE.md (3 rules: small commits, conventional format, <200 lines PR)
919
+ 15. "Engineering Standards", "Tool Usage Policy", and "Code Philosophy" sections in CLAUDE.md
877
920
 
878
921
  ## Tool Selection Rules
879
922
 
@@ -887,10 +930,10 @@ Do not add generic filler. Every line must be specific to the user's workflow.
887
930
  ## Context Budget (STRICT)
888
931
 
889
932
  - MCP servers: maximum 6. Prefer fewer.
890
- - CLAUDE.md: maximum 120 lines.
933
+ - CLAUDE.md: maximum 150 lines.
891
934
  - Rules: maximum 5 files, each under 20 lines.
892
935
  - Skills: maximum 3. Only include directly relevant ones.
893
- - Agents: maximum 3. QA pipeline + one specialist.
936
+ - Agents: maximum 5. Orchestration pipeline (/develop) agents.
894
937
  - Commands: no limit (loaded on demand, zero context cost).
895
938
  - Hooks: maximum 4 (auto-format, block-destructive, PostCompact, plus one contextual).
896
939
 
@@ -909,7 +952,7 @@ Return ONLY valid JSON matching this structure:
909
952
  { "tool_id": "id-from-registry", "reason": "why this tool fits" }
910
953
  ],
911
954
  "harness": {
912
- "claude_md": "The full CLAUDE.md content (under 120 lines)",
955
+ "claude_md": "The full CLAUDE.md content (under 150 lines)",
913
956
  "settings": {
914
957
  "permissions": {
915
958
  "allow": ["Bash(npm run *)", "Read", "Write", "Edit"],
@@ -921,7 +964,7 @@ Return ONLY valid JSON matching this structure:
921
964
  },
922
965
  "commands": {
923
966
  "help": "markdown content for /project:help",
924
- "tasks": "markdown content for /project:tasks"
967
+ "develop": "markdown content for /project:develop"
925
968
  },
926
969
  "rules": {
927
970
  "continuity": "markdown content for continuity rule",
@@ -931,13 +974,16 @@ Return ONLY valid JSON matching this structure:
931
974
  "skill-name/SKILL": "markdown content with YAML frontmatter"
932
975
  },
933
976
  "agents": {
934
- "qa-orchestrator": "agent markdown with YAML frontmatter"
977
+ "architect": "agent markdown with YAML frontmatter",
978
+ "planner": "agent markdown with YAML frontmatter",
979
+ "implementer": "agent markdown with YAML frontmatter",
980
+ "fixer": "agent markdown with YAML frontmatter",
981
+ "doc-updater": "agent markdown with YAML frontmatter"
935
982
  },
936
983
  "docs": {
937
- "TODO": "# TODO\\n\\n- [ ] First task",
938
984
  "DECISIONS": "# Decisions\\n\\nArchitectural decisions.",
939
985
  "LEARNINGS": "# Learnings\\n\\nNon-obvious discoveries.",
940
- "SPRINT": "# Sprint Contract\\n\\nDefine acceptance criteria."
986
+ "SPRINT": "# Sprint\\n\\nLiving spec and plan."
941
987
  }
942
988
  }
943
989
  }
@@ -1226,7 +1272,7 @@ function validateSpec(spec, onProgress) {
1226
1272
  if (spec.harness.claude_md) {
1227
1273
  const lines = spec.harness.claude_md.split("\n").length;
1228
1274
  if (lines > 150) {
1229
- warnings.push(`CLAUDE.md is ${lines} lines (recommended: \u2264100)`);
1275
+ warnings.push(`CLAUDE.md is ${lines} lines (recommended: \u2264150)`);
1230
1276
  }
1231
1277
  }
1232
1278
  if (spec.harness.skills && Object.keys(spec.harness.skills).length > 5) {
@@ -1345,10 +1391,10 @@ Read .claude/commands/ and list each one with a one-line description.
1345
1391
  Group them by workflow phase:
1346
1392
 
1347
1393
  PLAN: /project:spec, /project:sprint, /project:plan
1348
- BUILD: (just start coding \u2014 Claude reads CLAUDE.md automatically)
1394
+ BUILD: /project:develop (full pipeline), or just start coding
1349
1395
  VERIFY: /project:prove, /project:grill, /project:test
1350
1396
  SHIP: /project:commit, /project:review
1351
- MANAGE: /project:status, /project:tasks, /project:reset
1397
+ MANAGE: /project:status, /project:reset
1352
1398
 
1353
1399
  ## Your Agents
1354
1400
  Read .claude/agents/ and explain each one with how to invoke it.
@@ -1407,7 +1453,7 @@ var LOOP_COMMAND_CODE = `# Development Loop
1407
1453
  Run an assisted development cycle for the next feature.
1408
1454
 
1409
1455
  ## Phase 1: SPEC
1410
- Review docs/TODO.md and docs/SPRINT.md.
1456
+ Review docs/SPRINT.md.
1411
1457
  If no sprint is defined, run /project:spec to interview the user.
1412
1458
  Wait for user approval of the spec.
1413
1459
 
@@ -1432,7 +1478,7 @@ Fix any BLOCKERs.
1432
1478
 
1433
1479
  ## Phase 6: SHIP
1434
1480
  Run /project:commit.
1435
- Report what was built and what's next from docs/TODO.md.
1481
+ Report what was built and what's next from docs/SPRINT.md.
1436
1482
 
1437
1483
  Then ask: "Continue to next feature?"
1438
1484
  If yes, return to Phase 1.`;
@@ -1441,7 +1487,7 @@ var LOOP_COMMAND_RESEARCH = `# Research Loop
1441
1487
  Run an assisted research cycle.
1442
1488
 
1443
1489
  ## Phase 1: QUESTION
1444
- Review docs/TODO.md for the next research question.
1490
+ Review docs/SPRINT.md for the next research question.
1445
1491
  If none, ask the user what to investigate.
1446
1492
 
1447
1493
  ## Phase 2: RESEARCH
@@ -1457,7 +1503,7 @@ Present the summary. Ask the user for feedback.
1457
1503
  Revise based on feedback.
1458
1504
 
1459
1505
  ## Phase 5: NEXT
1460
- Update docs/TODO.md \u2014 mark question as done, identify follow-ups.
1506
+ Update docs/SPRINT.md \u2014 mark question as done, identify follow-ups.
1461
1507
  Ask: "Continue to next question?"`;
1462
1508
  var PM_AGENT = `---
1463
1509
  name: pm
@@ -1468,7 +1514,7 @@ model: opus
1468
1514
  You are a project manager for this codebase.
1469
1515
 
1470
1516
  Your responsibilities:
1471
- 1. Maintain docs/TODO.md \u2014 keep it prioritized and current
1517
+ 1. Maintain docs/SPRINT.md \u2014 keep it prioritized and current
1472
1518
  2. Write specs to docs/SPRINT.md when asked
1473
1519
  3. Review completed work and suggest what's next
1474
1520
  4. Track decisions in docs/DECISIONS.md
@@ -1487,7 +1533,7 @@ PM-driven development loop with PR delivery.
1487
1533
 
1488
1534
  ## Phase 1: PLAN (@pm)
1489
1535
  Use @pm to:
1490
- - Read docs/TODO.md and docs/SPRINT.md
1536
+ - Read docs/SPRINT.md
1491
1537
  - Select the highest-priority unfinished task
1492
1538
  - Write a spec to docs/SPRINT.md
1493
1539
  - Present the spec for approval
@@ -1517,7 +1563,7 @@ Create a pull request:
1517
1563
  ## Phase 6: NEXT
1518
1564
  Report:
1519
1565
  "PR #{N} ready for review: {link}
1520
- Next priority from TODO.md: {next task}
1566
+ Next priority from SPRINT.md: {next task}
1521
1567
  Continue? (y/n)"
1522
1568
 
1523
1569
  If yes, return to Phase 1 with next task.`;
@@ -1534,7 +1580,7 @@ PRs are opened automatically. You review when ready.
1534
1580
 
1535
1581
  ## The Loop
1536
1582
  Repeat until max features reached or stopped:
1537
- 1. @pm selects next priority from docs/TODO.md
1583
+ 1. @pm selects next priority from docs/SPRINT.md
1538
1584
  2. Create worktree + branch
1539
1585
  3. Implement the feature
1540
1586
  4. Run verification (build, test, lint)
@@ -1606,7 +1652,7 @@ function autonomyLabel(level) {
1606
1652
 
1607
1653
  // src/adapter/claude-code.ts
1608
1654
  var STATUS_LINE = {
1609
- command: `printf '%s | %s tasks' "$(git branch --show-current 2>/dev/null || echo 'no-git')" "$(grep -c '\\- \\[ \\]' docs/TODO.md 2>/dev/null || echo 0)"`
1655
+ command: `printf '%s | %s tasks' "$(git branch --show-current 2>/dev/null || echo 'no-git')" "$(grep -c '\\- \\[ \\]' docs/SPRINT.md 2>/dev/null || echo 0)"`
1610
1656
  };
1611
1657
  function isCodeProject(spec) {
1612
1658
  const commands = spec.harness.commands ?? {};