kyro-ai 3.2.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.
Files changed (140) hide show
  1. package/.claude-plugin/README.md +29 -0
  2. package/.claude-plugin/marketplace.json +52 -0
  3. package/.claude-plugin/plugin.json +40 -0
  4. package/.claude-plugin/settings.json +16 -0
  5. package/LICENSE +201 -0
  6. package/README.md +331 -0
  7. package/WORKFLOW.yaml +36 -0
  8. package/agents/orchestrator.md +393 -0
  9. package/commands/forge.md +55 -0
  10. package/commands/status.md +92 -0
  11. package/commands/wrap-up.md +85 -0
  12. package/config.json +17 -0
  13. package/contexts/init.md +64 -0
  14. package/contexts/review.md +89 -0
  15. package/contexts/sprint.md +90 -0
  16. package/dist/cli/adapters/codex.d.ts +3 -0
  17. package/dist/cli/adapters/codex.d.ts.map +1 -0
  18. package/dist/cli/adapters/codex.js +55 -0
  19. package/dist/cli/adapters/codex.js.map +1 -0
  20. package/dist/cli/adapters/command-skills.d.ts +5 -0
  21. package/dist/cli/adapters/command-skills.d.ts.map +1 -0
  22. package/dist/cli/adapters/command-skills.js +41 -0
  23. package/dist/cli/adapters/command-skills.js.map +1 -0
  24. package/dist/cli/adapters/opencode.d.ts +5 -0
  25. package/dist/cli/adapters/opencode.d.ts.map +1 -0
  26. package/dist/cli/adapters/opencode.js +41 -0
  27. package/dist/cli/adapters/opencode.js.map +1 -0
  28. package/dist/cli/adapters/registry-types.d.ts +13 -0
  29. package/dist/cli/adapters/registry-types.d.ts.map +1 -0
  30. package/dist/cli/adapters/registry-types.js +3 -0
  31. package/dist/cli/adapters/registry-types.js.map +1 -0
  32. package/dist/cli/adapters/registry.d.ts +7 -0
  33. package/dist/cli/adapters/registry.d.ts.map +1 -0
  34. package/dist/cli/adapters/registry.js +46 -0
  35. package/dist/cli/adapters/registry.js.map +1 -0
  36. package/dist/cli/app.d.ts +2 -0
  37. package/dist/cli/app.d.ts.map +1 -0
  38. package/dist/cli/app.js +46 -0
  39. package/dist/cli/app.js.map +1 -0
  40. package/dist/cli/commands/doctor.d.ts +2 -0
  41. package/dist/cli/commands/doctor.d.ts.map +1 -0
  42. package/dist/cli/commands/doctor.js +133 -0
  43. package/dist/cli/commands/doctor.js.map +1 -0
  44. package/dist/cli/commands/install.d.ts +4 -0
  45. package/dist/cli/commands/install.d.ts.map +1 -0
  46. package/dist/cli/commands/install.js +42 -0
  47. package/dist/cli/commands/install.js.map +1 -0
  48. package/dist/cli/commands/tui.d.ts +2 -0
  49. package/dist/cli/commands/tui.d.ts.map +1 -0
  50. package/dist/cli/commands/tui.js +35 -0
  51. package/dist/cli/commands/tui.js.map +1 -0
  52. package/dist/cli/commands/uninstall.d.ts +3 -0
  53. package/dist/cli/commands/uninstall.d.ts.map +1 -0
  54. package/dist/cli/commands/uninstall.js +33 -0
  55. package/dist/cli/commands/uninstall.js.map +1 -0
  56. package/dist/cli/constants.d.ts +23 -0
  57. package/dist/cli/constants.d.ts.map +1 -0
  58. package/dist/cli/constants.js +27 -0
  59. package/dist/cli/constants.js.map +1 -0
  60. package/dist/cli/fs.d.ts +12 -0
  61. package/dist/cli/fs.d.ts.map +1 -0
  62. package/dist/cli/fs.js +133 -0
  63. package/dist/cli/fs.js.map +1 -0
  64. package/dist/cli/help.d.ts +4 -0
  65. package/dist/cli/help.d.ts.map +1 -0
  66. package/dist/cli/help.js +28 -0
  67. package/dist/cli/help.js.map +1 -0
  68. package/dist/cli/install-plan.d.ts +3 -0
  69. package/dist/cli/install-plan.d.ts.map +1 -0
  70. package/dist/cli/install-plan.js +93 -0
  71. package/dist/cli/install-plan.js.map +1 -0
  72. package/dist/cli/options.d.ts +8 -0
  73. package/dist/cli/options.d.ts.map +1 -0
  74. package/dist/cli/options.js +99 -0
  75. package/dist/cli/options.js.map +1 -0
  76. package/dist/cli/state.d.ts +4 -0
  77. package/dist/cli/state.d.ts.map +1 -0
  78. package/dist/cli/state.js +13 -0
  79. package/dist/cli/state.js.map +1 -0
  80. package/dist/cli/types.d.ts +50 -0
  81. package/dist/cli/types.d.ts.map +1 -0
  82. package/dist/cli/types.js +3 -0
  83. package/dist/cli/types.js.map +1 -0
  84. package/dist/cli.d.ts +3 -0
  85. package/dist/cli.d.ts.map +1 -0
  86. package/dist/cli.js +10 -0
  87. package/dist/cli.js.map +1 -0
  88. package/dist/index.d.ts +10 -0
  89. package/dist/index.d.ts.map +1 -0
  90. package/dist/index.js +12 -0
  91. package/dist/index.js.map +1 -0
  92. package/docs/HOW-TO-USE-CODEX.md +82 -0
  93. package/docs/HOW-TO-USE-OPENCODE.md +93 -0
  94. package/docs/agent-adapters.md +152 -0
  95. package/docs/agents-reference.md +153 -0
  96. package/docs/architecture.md +159 -0
  97. package/docs/architecture.mmd +21 -0
  98. package/docs/cli.md +87 -0
  99. package/docs/commands-reference.md +138 -0
  100. package/docs/context-management.md +92 -0
  101. package/docs/getting-started.md +165 -0
  102. package/docs/harness-migration.md +95 -0
  103. package/docs/programmatic-usage.md +109 -0
  104. package/docs/rules-guide.md +216 -0
  105. package/package.json +78 -0
  106. package/rules/context-persistence.md +54 -0
  107. package/rules/estimation.md +56 -0
  108. package/rules/learning-rules.md +66 -0
  109. package/rules/quality-gates.md +65 -0
  110. package/rules/sprint-discipline.md +49 -0
  111. package/scripts/check-markdown-links.mjs +97 -0
  112. package/scripts/check-versions.mjs +46 -0
  113. package/scripts/make-cli-executable.mjs +12 -0
  114. package/settings.example.json +27 -0
  115. package/skills/qa-review/SKILL.md +660 -0
  116. package/skills/qa-review/manifest.json +41 -0
  117. package/skills/sprint-forge/SKILL.md +260 -0
  118. package/skills/sprint-forge/assets/README.md +31 -0
  119. package/skills/sprint-forge/assets/helpers/analysis-guide.md +207 -0
  120. package/skills/sprint-forge/assets/helpers/analyzer.md +83 -0
  121. package/skills/sprint-forge/assets/helpers/debt-tracker.md +122 -0
  122. package/skills/sprint-forge/assets/helpers/handoff.md +103 -0
  123. package/skills/sprint-forge/assets/helpers/learner.md +69 -0
  124. package/skills/sprint-forge/assets/helpers/metrics.md +81 -0
  125. package/skills/sprint-forge/assets/helpers/reentry-generator.md +121 -0
  126. package/skills/sprint-forge/assets/helpers/reviewer.md +71 -0
  127. package/skills/sprint-forge/assets/helpers/sprint-generator.md +145 -0
  128. package/skills/sprint-forge/assets/modes/INIT.md +204 -0
  129. package/skills/sprint-forge/assets/modes/SPRINT.md +253 -0
  130. package/skills/sprint-forge/assets/modes/STATUS.md +145 -0
  131. package/skills/sprint-forge/assets/templates/PROJECT-README.md +107 -0
  132. package/skills/sprint-forge/assets/templates/REENTRY-PROMPTS.md +132 -0
  133. package/skills/sprint-forge/assets/templates/ROADMAP.md +126 -0
  134. package/skills/sprint-forge/assets/templates/SPRINT.md +189 -0
  135. package/skills/sprint-forge/manifest.json +165 -0
  136. package/templates/split-claude-md/AGENTS.md +96 -0
  137. package/templates/split-claude-md/CLAUDE.md +67 -0
  138. package/templates/split-claude-md/COMMANDS.md +37 -0
  139. package/templates/split-claude-md/LEARNED.md +39 -0
  140. package/templates/split-claude-md/SOUL.md +107 -0
@@ -0,0 +1,92 @@
1
+ # Context Management Guide
2
+
3
+ How to manage token limits, prevent context overflow, and use compaction strategies effectively with Kyro.
4
+
5
+ ---
6
+
7
+ ## Token Limits
8
+
9
+ AI models have finite context windows. When your conversation approaches the limit, older messages are compacted (summarized). This can cause loss of nuance.
10
+
11
+ | Factor | Guideline |
12
+ |--------|-----------|
13
+ | Root agent instructions | < 60 lines — loaded on every message |
14
+ | Total agent instructions | < 150 lines — larger files waste context on every turn |
15
+ | MCP servers | < 10 active MCPs — each adds tool definitions to context |
16
+ | MCP tools total | < 80 tools — tool descriptions consume tokens |
17
+ | Sprint file size | Keep under 500 lines — use separate files for large sprints |
18
+
19
+ ---
20
+
21
+ ## Compaction Strategies
22
+
23
+ ### What is compaction?
24
+
25
+ When the conversation approaches the context limit, the system compresses older messages into a summary. This preserves the most recent context but may lose details from earlier turns.
26
+
27
+ ### Good compact points
28
+
29
+ Kyro is designed with natural compact points:
30
+
31
+ | Point | Why it's safe |
32
+ |-------|---------------|
33
+ | **Between phases** | Phase checkpoint saves all progress to the sprint file |
34
+ | **After INIT analysis** | Findings are written to files — context can be rebuilt from them |
35
+ | **After sprint generation** | Sprint document captures everything needed for execution |
36
+ | **Between sprints** | Re-entry prompts capture full project state |
37
+
38
+ ### Bad compact points
39
+
40
+ | Point | Why it's risky |
41
+ |-------|----------------|
42
+ | **Mid-task** | Partial work may be lost — the task state is in the agent's memory |
43
+ | **During retro** | Retro insights come from the full execution context |
44
+ | **During debt table update** | Requires knowledge of what was resolved in this sprint |
45
+
46
+ ### Proactive compaction
47
+
48
+ Set the environment variable to trigger compaction earlier (before the system forces it):
49
+
50
+ ```bash
51
+ export CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=50
52
+ ```
53
+
54
+ This triggers compaction at 50% context usage instead of the default. Useful for long sprints with many phases.
55
+
56
+ ---
57
+
58
+ ## Re-entry Prompts
59
+
60
+ Re-entry prompts are Kyro's primary defense against context loss. After each sprint execution, re-entry prompts are updated with:
61
+
62
+ - Current sprint number and status
63
+ - File paths for all project artifacts
64
+ - Pre-written prompts for common actions (generate next sprint, execute, check status)
65
+
66
+ If compaction happens mid-session, a new agent can use the re-entry prompt to recover full context.
67
+
68
+ ---
69
+
70
+ ## Tips for Large Projects
71
+
72
+ 1. **One sprint per session** — For projects with 5+ sprints, start a new session for each sprint. Re-entry prompts ensure continuity.
73
+
74
+ 2. **Minimize CLAUDE.md** — Move detailed instructions to separate files that are loaded on-demand, not on every message.
75
+
76
+ 3. **Use lighter models for read-only exploration** — The analysis phase reads many files. A lighter model can reduce cost when the task is status, inventory, or summarization. Use the strongest available model for implementation, debugging, and architecture decisions.
77
+
78
+ 4. **Checkpoint aggressively** — Kyro checkpoints after each phase. This means progress survives compaction.
79
+
80
+ 5. **Avoid loading unnecessary skills** — Each loaded skill adds to the context. Only invoke skills when needed.
81
+
82
+ ---
83
+
84
+ ## Pre-Compaction Checkpoint
85
+
86
+ Before context compaction, save the current sprint state and update re-entry prompts:
87
+
88
+ - Logs a warning that compaction is about to happen
89
+ - Checks for active sprint and reminds about re-entry prompts
90
+ - Points to the re-entry prompts file path
91
+
92
+ This gives the agent (and user) a chance to save state before context is compressed.
@@ -0,0 +1,165 @@
1
+ # Getting Started with Kyro
2
+
3
+ Kyro is a portable, markdown-first workflow kit for AI coding agents. It coordinates sprint-based execution through one orchestrator, reusable skills, command intent documents, persistent project rules, and `.agents/kyro/scopes/{scope}/` artifacts.
4
+
5
+ Kyro does not require a specific model provider. Claude Code is supported through a native adapter, while Codex, OpenCode, Cursor, and generic agents can use the same core files manually.
6
+
7
+ ---
8
+
9
+ ## Prerequisites
10
+
11
+ - **Node.js >= 18** -- required to build and package Kyro
12
+ - **Git** -- recommended for project workflows and review
13
+ - **An AI coding agent** -- Claude Code, Codex, OpenCode, Cursor, or another agent that can read markdown instructions
14
+
15
+ Verify your Node.js version:
16
+
17
+ ```bash
18
+ node --version
19
+ # v18.0.0 or higher
20
+ ```
21
+
22
+ ---
23
+
24
+ ## Installation Paths
25
+
26
+ ### Claude Code Adapter
27
+
28
+ Use this path when you want Claude Code to register Kyro slash commands, agents, and skills automatically:
29
+
30
+ ```bash
31
+ /plugin install SynapSync/kyro-ai
32
+ ```
33
+
34
+ For local development:
35
+
36
+ ```bash
37
+ git clone https://github.com/SynapSync/kyro-ai.git ~/.claude/plugins/kyro-ai
38
+ cd ~/.claude/plugins/kyro-ai
39
+ npm install
40
+ npm run build
41
+ claude --plugin-dir ~/.claude/plugins/kyro-ai
42
+ ```
43
+
44
+ ### Generic Agent Setup
45
+
46
+ Use this path for agents without a verified Kyro-native plugin mechanism:
47
+
48
+ ```bash
49
+ git clone https://github.com/SynapSync/kyro-ai.git ~/kyro-ai
50
+ cd your-project
51
+ mkdir -p .agents .skills
52
+ cp -R ~/kyro-ai/agents .agents/kyro
53
+ cp -R ~/kyro-ai/skills/sprint-forge .skills/sprint-forge
54
+ cp -R ~/kyro-ai/skills/qa-review .skills/qa-review
55
+ mkdir -p .agents/kyro/scopes
56
+ ```
57
+
58
+ Then expose these files as project context or rules in your agent:
59
+
60
+ - `.agents/kyro/orchestrator.md`
61
+ - `.skills/sprint-forge/SKILL.md`
62
+ - `.skills/qa-review/SKILL.md`
63
+ - Kyro command intent files from `commands/*.md`, when your agent supports slash commands or reusable prompts
64
+
65
+ See [agent-adapters.md](agent-adapters.md) for Codex, OpenCode, Cursor, and generic AGENTS guidance.
66
+
67
+ ---
68
+
69
+ ## First Run
70
+
71
+ If your platform supports Kyro slash commands, start with:
72
+
73
+ ```text
74
+ /kyro:forge analyze the authentication module
75
+ ```
76
+
77
+ If your platform does not support slash commands, invoke the same intent manually:
78
+
79
+ ```text
80
+ Use Kyro forge mode. Read the orchestrator, core, and qa-review instructions. Analyze the authentication module, produce findings, create or update the sprint artifacts under .agents/kyro/scopes/{scope}/, and stop at each approval gate.
81
+ ```
82
+
83
+ This starts the full sprint cycle:
84
+
85
+ 1. The analysis phase explores the codebase in read-only mode.
86
+ 2. You approve the analysis at Gate 1.
87
+ 3. Kyro generates a sprint plan with phases and tasks.
88
+ 4. You approve the plan at Gate 2.
89
+ 5. Tasks are executed one by one and validated.
90
+ 6. You approve the implementation at Gate 3.
91
+ 7. A retrospective is run and the sprint is closed.
92
+
93
+ To check progress, use `/kyro:status` or ask the agent to run Kyro status mode by reading `.agents/kyro/scopes/{scope}/`.
94
+
95
+ ---
96
+
97
+ ## Output Structure
98
+
99
+ After running forge in INIT mode, Kyro creates a scope workspace:
100
+
101
+ ```text
102
+ .agents/kyro/scopes/{scope}/
103
+ ├── README.md
104
+ ├── ROADMAP.md
105
+ ├── RE-ENTRY-PROMPTS.md
106
+ ├── findings/
107
+ ├── phases/
108
+ └── handoffs/
109
+ ```
110
+
111
+ Project rules are stored in:
112
+
113
+ ```text
114
+ .agents/kyro/scopes/rules.md
115
+ ```
116
+
117
+ The artifact files are the compatibility layer. Any agent that can read and write these files can continue the Kyro workflow.
118
+
119
+ ---
120
+
121
+ ## Key Concepts
122
+
123
+ ### Modes
124
+
125
+ | Mode | When to Use | What It Does |
126
+ | --- | --- | --- |
127
+ | INIT | Starting a new project workflow | Analyzes the codebase, generates findings, creates a roadmap, and scaffolds the output directory |
128
+ | SPRINT | Ready to work on the next iteration | Generates a sprint from the roadmap and previous retro, then optionally executes it task by task |
129
+ | STATUS | Checking progress | Reads sprint files and reports progress, debt status, and next sprint context |
130
+
131
+ ### Gates
132
+
133
+ Gates are mandatory approval checkpoints. Kyro never proceeds past a gate without explicit user approval:
134
+
135
+ - **Gate 1** -- after analysis, before planning
136
+ - **Gate 2** -- after sprint plan generation, before implementation
137
+ - **Gate 3** -- after implementation, before review and close
138
+
139
+ ### Checkpoints
140
+
141
+ Sprint files are saved to disk after each phase completes. This keeps progress recoverable across session restarts, context compaction, or switching agents.
142
+
143
+ ### Rules
144
+
145
+ When you correct an agent during a sprint, the correction can become a persistent project rule:
146
+
147
+ ```text
148
+ User correction -> proposed rule -> user approval -> .agents/kyro/scopes/rules.md
149
+ ```
150
+
151
+ Rules are specific, dated, and tied to the project where they were learned. See [rules-guide.md](rules-guide.md).
152
+
153
+ ### Debt Tracking
154
+
155
+ Technical debt is tracked formally across sprints. Items are never deleted; only their status changes.
156
+
157
+ ---
158
+
159
+ ## Next Steps
160
+
161
+ - [Agent Adapters](agent-adapters.md) -- setup guidance for Claude Code, Codex, OpenCode, Cursor, and generic agents
162
+ - [Commands Reference](commands-reference.md) -- syntax and examples for all 3 command intents
163
+ - [Agents Reference](agents-reference.md) -- how the orchestrator and protocols work
164
+ - [Rules Guide](rules-guide.md) -- the per-project learning system
165
+ - [Architecture](architecture.md) -- system design and data flow
@@ -0,0 +1,95 @@
1
+ # Harness Migration — Multi-Agent Runtime Direction
2
+
3
+ Kyro is evolving from a markdown-heavy workflow into an installable harness for AI-assisted software delivery. The goal is not to abandon existing adapters. The goal is to make Kyro practical across Claude, Codex, OpenCode, Cursor, and other AGENTS.md-compatible environments with one consistent operating model.
4
+
5
+ ## Current Problem
6
+
7
+ Kyro currently works best where a host can load its plugin, commands, agents, and skills directly. Outside that environment, teams must manually copy or install pieces of the workflow and ask each agent to interpret large markdown instructions.
8
+
9
+ That creates predictable issues:
10
+
11
+ - agents consume too many tokens before doing useful work
12
+ - validation depends too much on prose discipline
13
+ - state is reconstructed from markdown instead of queried from a structured source
14
+ - install/setup differs per agent
15
+ - health checks are not available as a first-class runtime command
16
+
17
+ Plan A stabilizes the current package first: version checks, link checks, package health checks, and command/orchestrator deduplication. Track B builds the harness runtime on top of that stable base.
18
+
19
+ ## Target Direction
20
+
21
+ Kyro should become a **multi-agent harness** with:
22
+
23
+ - a small CLI/runtime that owns deterministic checks and state operations
24
+ - thin adapter prompts for each supported agent
25
+ - markdown artifacts that remain human-readable and git-friendly
26
+ - structured sidecar state for things agents should not parse from prose
27
+ - first-class support for both Claude plugin workflows and non-Claude agents
28
+
29
+ Claude plugin support remains a supported adapter. It should not be treated as legacy or removed just because Kyro adds a CLI and additional adapters.
30
+
31
+ ## Adapter Model
32
+
33
+ Kyro should support multiple agent surfaces through adapter-specific packaging:
34
+
35
+ | Adapter | Expected Role |
36
+ | --- | --- |
37
+ | Claude plugin | First-class native plugin experience with commands, agents, and skills |
38
+ | Codex | Project instructions and CLI-backed workflow commands |
39
+ | OpenCode | Project-local context plus CLI-backed status, checks, and artifacts |
40
+ | Cursor | Project rules plus CLI-backed workflow state |
41
+
42
+ The stable contract across all adapters is:
43
+
44
+ 1. use Kyro artifact paths consistently
45
+ 2. let deterministic code validate package and project health
46
+ 3. keep large workflow detail out of always-loaded prompts
47
+ 4. preserve markdown as the collaborative human interface
48
+
49
+ ## Runtime Responsibilities
50
+
51
+ The future runtime should own behavior that is currently too fragile as prose:
52
+
53
+ - package diagnostics: versions, links, missing assets, invalid manifests
54
+ - project diagnostics: artifact layout, sprint state, debt consistency
55
+ - state queries: current scope, current sprint, next recommended action
56
+ - rendering: structured state to markdown views
57
+ - install scaffolding: agent-specific bootstrap files
58
+
59
+ The agent should still do the creative and engineering work: analysis, implementation, review, and decision-making. The harness should make that work observable, repeatable, and easier to validate.
60
+
61
+ ## Non-Goals for Plan A
62
+
63
+ Plan A does not implement the CLI runtime.
64
+
65
+ Plan A does not replace the Claude plugin.
66
+
67
+ Plan A does not redesign sprint-forge behavior.
68
+
69
+ Plan A only prepares the repository so Track B can build the harness from a stable, tested baseline.
70
+
71
+ ## Track B Starting Point
72
+
73
+ Track B begins with the smallest useful multi-agent installer:
74
+
75
+ ```bash
76
+ kyro
77
+ kyro install --agent opencode --scope workspace
78
+ kyro doctor
79
+ kyro sync
80
+ kyro uninstall
81
+ ```
82
+
83
+ Recommended first implementation order:
84
+
85
+ 1. `kyro install --agent opencode --scope workspace` and `kyro install --agent codex --scope workspace` for native command/skill projection
86
+ 2. `kyro doctor` for package/project health checks
87
+ 3. `kyro sync` for managed asset refresh
88
+ 4. adapter-specific install templates for Claude, Cursor, and additional concrete agent surfaces
89
+ 5. structured scoped `state.json` only when a scope is created or opened
90
+
91
+ This keeps Kyro portable without forcing every agent to load the whole workflow into context.
92
+
93
+ ## Generic Adapter Decision
94
+
95
+ Kyro intentionally does not ship a `generic` install adapter. The root `AGENTS.md` file is the cross-agent instruction standard; concrete adapters should install concrete command/skill projections for agents that support them.
@@ -0,0 +1,109 @@
1
+ # Programmatic Usage
2
+
3
+ Kyro can be used with any LLM API by loading its markdown instructions into your application's prompts. This is a programmatic adapter pattern, not a built-in runtime.
4
+
5
+ ---
6
+
7
+ ## Core Pattern
8
+
9
+ 1. Load the relevant Kyro files.
10
+ 2. Provide project context and artifact paths.
11
+ 3. Ask the model to run a Kyro intent.
12
+ 4. Save the generated markdown artifacts back to disk or your storage layer.
13
+
14
+ ```pseudo
15
+ orchestrator = read("agents/orchestrator.md")
16
+ kyro_core = read("skills/sprint-forge/SKILL.md")
17
+ qa_review = read("skills/qa-review/SKILL.md")
18
+
19
+ system_prompt = join([
20
+ orchestrator,
21
+ kyro_core,
22
+ qa_review
23
+ ])
24
+
25
+ response = llm.generate({
26
+ model: SELECTED_MODEL,
27
+ system: system_prompt,
28
+ input: """
29
+ Run the forge intent for scope: oauth-implementation.
30
+ Use artifact root: .agents/kyro/scopes/oauth-implementation/.
31
+ Current project context:
32
+ {PROJECT_CONTEXT}
33
+ """
34
+ })
35
+
36
+ write_artifacts(response)
37
+ ```
38
+
39
+ ---
40
+
41
+ ## Provider-Neutral Review Example
42
+
43
+ ```pseudo
44
+ qa_review = read("skills/qa-review/SKILL.md")
45
+
46
+ response = llm.generate({
47
+ model: STRONG_REVIEW_MODEL,
48
+ system: qa_review,
49
+ input: """
50
+ Review this change using the qa-review skill.
51
+
52
+ Files:
53
+ {CHANGED_FILES}
54
+
55
+ Diff:
56
+ {DIFF}
57
+
58
+ Return APPROVED, APPROVED WITH NOTES, CHANGES REQUIRED, or REJECTED.
59
+ """
60
+ })
61
+ ```
62
+
63
+ ---
64
+
65
+ ## Provider-Neutral Sprint Example
66
+
67
+ ```pseudo
68
+ orchestrator = read("agents/orchestrator.md")
69
+ kyro_core = read("skills/sprint-forge/SKILL.md")
70
+
71
+ response = llm.generate({
72
+ model: STRONG_PLANNING_MODEL,
73
+ system: join([orchestrator, kyro_core]),
74
+ input: """
75
+ Run the status intent for .agents/kyro/scopes/{scope}/.
76
+ Then generate the next sprint if the roadmap and previous sprint support it.
77
+ """
78
+ })
79
+ ```
80
+
81
+ ---
82
+
83
+ ## Artifact Contract
84
+
85
+ Your host application is responsible for persistence:
86
+
87
+ - Write findings to `.agents/kyro/scopes/{scope}/findings/`.
88
+ - Write sprint documents to `.agents/kyro/scopes/{scope}/phases/`.
89
+ - Keep `ROADMAP.md`, `RE-ENTRY-PROMPTS.md`, and `rules.md` in sync.
90
+ - Run verification commands outside the model when possible.
91
+
92
+ ---
93
+
94
+ ## Model Guidance
95
+
96
+ Kyro does not require a specific provider or model family.
97
+
98
+ - Use a high-capability model for implementation, debugging, and architecture decisions.
99
+ - Use a faster/lower-cost model for read-only status reports or simple documentation review.
100
+ - Keep model names out of Kyro's sprint-forge artifacts unless you are recording which model modified a document.
101
+
102
+ ---
103
+
104
+ ## Safety Notes
105
+
106
+ - Treat model output as a patch proposal unless your host application validates and writes files explicitly.
107
+ - Keep secrets out of prompts.
108
+ - Run tests, typechecks, and builds outside the model.
109
+ - Preserve the markdown artifact layout so future agents can resume work.
@@ -0,0 +1,216 @@
1
+ # Rules Guide -- Per-Project Learning System
2
+
3
+ Kyro accumulates knowledge across sprints through a persistent rules file at `.agents/kyro/scopes/rules.md`. Rules capture corrections, patterns, and estimation insights so that mistakes made once are never repeated.
4
+
5
+ ---
6
+
7
+ ## How Rules Are Captured
8
+
9
+ The learning flow moves from correction to persistent rule in four steps:
10
+
11
+ ```
12
+ 1. User corrects the agent during a sprint
13
+ |
14
+ v
15
+ 2. Agent proposes a rule based on the correction
16
+ |
17
+ v
18
+ 3. User approves (or edits) the proposed rule
19
+ |
20
+ v
21
+ 4. Rule is appended to .agents/kyro/scopes/rules.md
22
+ ```
23
+
24
+ ### Detection
25
+
26
+ Rules are captured from two sources:
27
+
28
+ - **Explicit corrections** -- the user tells the agent it did something wrong. These have the highest confidence.
29
+ - **Pattern detection** -- the agent identifies a recurring pattern worth codifying (e.g., "DB migration tasks consistently take 40% longer than estimated"). These are proactive suggestions with lower confidence.
30
+
31
+ ### Proposal Format
32
+
33
+ When a correction or pattern is detected, the agent proposes a rule:
34
+
35
+ ```
36
+ Detected a pattern worth remembering:
37
+
38
+ [RULE-XXX] Category: One-line rule
39
+ Context: Why this rule exists
40
+ Source: Sprint N, Project: project-name
41
+
42
+ Save this rule? (yes/no/edit)
43
+ ```
44
+
45
+ The user can:
46
+ - **yes** -- save the rule as proposed
47
+ - **no** -- discard the proposal
48
+ - **edit** -- modify the rule text before saving
49
+
50
+ ### Storage
51
+
52
+ Approved rules are appended to `.agents/kyro/scopes/rules.md` and logged in the sprint's `LEARNED` section.
53
+
54
+ ---
55
+
56
+ ## Rule Format and Categories
57
+
58
+ Rules follow a standard format with categories that determine when they are applied.
59
+
60
+ ### Format
61
+
62
+ Each rule is a single line with structured metadata:
63
+
64
+ ```
65
+ - [RULE-NNN] One-line actionable rule (YYYY-MM-DD, project: project-name)
66
+ ```
67
+
68
+ Components:
69
+ - `RULE-NNN` -- unique sequential identifier
70
+ - Rule text -- specific, actionable instruction
71
+ - Date -- when the rule was learned
72
+ - Project -- where the rule was learned (for traceability)
73
+
74
+ ### Categories
75
+
76
+ Rules are organized into categories that correspond to different phases of sprint execution:
77
+
78
+ ```markdown
79
+ # Kyro -- Learned Rules
80
+
81
+ ## Estimation
82
+ - [RULE-001] DB migration tasks: add 20% buffer to estimates (2026-02-20, project: nebux-api)
83
+ - [RULE-002] Auth tasks frequently reveal hidden dependencies (2026-02-22, project: nebux-api)
84
+
85
+ ## Quality
86
+ - [RULE-003] Always validate version compatibility before adding dependencies (2026-02-25, project: synap-sync)
87
+
88
+ ## Architecture
89
+ - [RULE-004] Extract shared validation logic before 3rd duplication (2026-03-01, project: skills-registry)
90
+
91
+ ## Testing
92
+ - [RULE-005] E2E tests for auth flows catch integration issues that unit tests miss (2026-03-03, project: nebux-api)
93
+
94
+ ## Process
95
+ - [RULE-006] Run full quality gates before closing sprint, not just per-task (2026-03-05, project: synap-sync)
96
+ ```
97
+
98
+ | Category | Applied During | Examples |
99
+ |----------|---------------|----------|
100
+ | **Estimation** | Sprint generation (Phase 2) | Buffer adjustments, complexity flags |
101
+ | **Quality** | Task execution and review (Phase 3) | Validation steps, dependency checks |
102
+ | **Architecture** | Analysis and planning (Phase 1-2) | Pattern preferences, boundary rules |
103
+ | **Testing** | Task validation (Phase 3) | Test strategy, coverage requirements |
104
+ | **Process** | All phases | Workflow preferences, gate behavior |
105
+
106
+ ---
107
+
108
+ ## How Rules Are Loaded and Applied
109
+
110
+ ### Loading
111
+
112
+ At the start of every session, the orchestrator startup checkpoint:
113
+
114
+ 1. Reads `.agents/kyro/scopes/rules.md` (path configurable in `config.json`)
115
+ 2. Parses all active rules
116
+ 3. Makes them available to the orchestrator for the session
117
+
118
+ Loading is automatic when `config.json` has `rules.auto_load: true` (the default).
119
+
120
+ ### Application
121
+
122
+ Rules are applied contextually based on their category:
123
+
124
+ - **Before generating sprint estimates** -- check Estimation rules. If a rule applies (e.g., "DB migration tasks: add 20% buffer"), adjust the estimate and note the adjustment.
125
+ - **Before architecture decisions** -- check Architecture rules. If a rule applies, follow it or explicitly justify deviation.
126
+ - **During task execution** -- check Quality and Testing rules. If a rule is about to be violated, pause and show the rule to the user.
127
+ - **During sprint planning** -- check Process rules.
128
+
129
+ ### Rule Violation Warning
130
+
131
+ When the agent is about to violate a learned rule, the orchestrator rule checkpoint triggers a warning:
132
+
133
+ ```
134
+ [Kyro] Rule violation detected:
135
+ [RULE-003] Always validate version compatibility before adding dependencies
136
+ Source: 2026-02-25, project: synap-sync
137
+
138
+ The current action appears to skip version validation.
139
+ Proceed anyway? (yes/no)
140
+ ```
141
+
142
+ ## Managing Rules
143
+
144
+ ### Deprecating a Rule
145
+
146
+ When a rule is no longer relevant (technology changed, project context shifted), mark it as deprecated:
147
+
148
+ ```markdown
149
+ ## Estimation
150
+ - [RULE-001] DB migration tasks: add 20% buffer to estimates (2026-02-20, project: nebux-api)
151
+ - ~~[RULE-002] Auth tasks frequently reveal hidden dependencies (2026-02-22, project: nebux-api)~~ [DEPRECATED: auth module rewritten in Sprint 5]
152
+ ```
153
+
154
+ Deprecated rules are kept for history but are no longer applied.
155
+
156
+ ### Evolving a Rule
157
+
158
+ When a rule needs updating based on new experience, create a new rule that references the original:
159
+
160
+ ```markdown
161
+ ## Estimation
162
+ - ~~[RULE-001] DB migration tasks: add 20% buffer to estimates~~ [EVOLVED -> RULE-015]
163
+ - [RULE-015] DB migration tasks: add 30% buffer when involving foreign key changes, 20% otherwise (2026-03-08, project: nebux-api, evolved from RULE-001)
164
+ ```
165
+
166
+ ### Consolidating Rules
167
+
168
+ After accumulating many rules, related rules can be consolidated:
169
+
170
+ ```markdown
171
+ ## Estimation
172
+ - ~~[RULE-001] DB migration tasks: add 20% buffer~~ [CONSOLIDATED -> RULE-020]
173
+ - ~~[RULE-002] Auth tasks: reveal hidden dependencies~~ [CONSOLIDATED -> RULE-020]
174
+ - [RULE-020] Complex backend tasks (DB migrations, auth, payments): add 20-30% buffer and check for hidden dependencies before estimating (2026-03-08, consolidated from RULE-001, RULE-002)
175
+ ```
176
+
177
+ ### Rule Limits
178
+
179
+ The learner helper enforces a maximum of **50 active rules**. When approaching this limit:
180
+ - Review rules during sprint retros -- rarely-used rules may be candidates for deprecation
181
+ - Consolidate related rules into broader, more useful ones
182
+ - Deprecate rules tied to completed or abandoned projects
183
+
184
+ ---
185
+
186
+ ## Example rules.md File
187
+
188
+ ```markdown
189
+ # Kyro -- Learned Rules
190
+
191
+ > Accumulated rules from sprint execution for this project.
192
+ > Loaded automatically at session start. Applied contextually by category.
193
+ > Maximum 50 active rules. Deprecate or consolidate when approaching limit.
194
+
195
+ ## Estimation
196
+ - [RULE-001] DB migration tasks: add 20% buffer to estimates (2026-02-20, project: nebux-api)
197
+ - [RULE-002] Auth tasks frequently reveal hidden dependencies -- add 20% buffer (2026-02-22, project: nebux-api)
198
+ - [RULE-008] UI animation tasks take 2x longer when involving cross-platform support (2026-03-05, project: mobile-app)
199
+
200
+ ## Quality
201
+ - [RULE-003] Always validate version compatibility before adding dependencies (2026-02-25, project: synap-sync)
202
+ - [RULE-009] Never use string concatenation for SQL queries -- always parameterized (2026-03-06, project: nebux-api)
203
+
204
+ ## Architecture
205
+ - [RULE-004] Extract shared validation logic before 3rd duplication (2026-03-01, project: skills-registry)
206
+ - [RULE-010] Prefer composition over inheritance for middleware chains (2026-03-06, project: nebux-api)
207
+
208
+ ## Testing
209
+ - [RULE-005] E2E tests for auth flows catch integration issues that unit tests miss (2026-03-03, project: nebux-api)
210
+ - [RULE-011] Always test error paths, not just happy paths (2026-03-07, project: synap-sync)
211
+
212
+ ## Process
213
+ - [RULE-006] Run full quality gates before closing sprint, not just per-task (2026-03-05, project: synap-sync)
214
+ - [RULE-007] Always validate version compatibility before adding new dependencies (2026-03-05, project: synap-sync)
215
+ - ~~[RULE-012] Use npm ci instead of npm install in CI pipelines (2026-03-07, project: nebux-api)~~ [DEPRECATED: migrated to pnpm]
216
+ ```