Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions docs/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
| --------------- | ---------------- | ------------ | --- | -------------------------------- | ------------- | -------------- | ----------------------------------- |
| Claude Code | `claude-code` | Yes | Yes | Full (Task tool) | Yes | No | `~/.claude` |
| OpenCode | `opencode` | Yes | Yes | Full (multi-mode overlay) | No | Yes | `~/.config/opencode` |
| Kilo Code | `kilocode` | Yes | Yes | Full (multi-mode overlay) | No | Yes | `~/.config/kilo` |
| Kilo Code | `kilocode` | Yes | Yes | Full (native subagents + overlay)| No | Yes | `~/.config/kilo` + `~/.kilo/agents`|
| Gemini CLI | `gemini-cli` | Yes | Yes | Full (experimental) | No | No | `~/.gemini` |
| Cursor | `cursor` | Yes | Yes | Full (native subagents) | No | No | `~/.cursor` |
| VS Code Copilot | `vscode-copilot` | Yes | Yes | Full (runSubagent) | No | No | `~/.copilot` + VS Code User profile |
Expand Down Expand Up @@ -110,7 +110,10 @@ Kiro uses native custom agents in `~/.kiro/agents/`. `gentle-ai` writes phase ag

- **Detection**: gentle-ai detects Kilo Code from `~/.config/kilo` and checks for the `kilo` binary on `PATH`
- Uses the OpenCode-compatible adapter: `AGENTS.md`, `skills/`, `commands/`, and `opencode.json` live under `~/.config/kilo`
- Full SDD delegation is provided by the merged multi-agent overlay in `~/.config/kilo/opencode.json`, not by a separate native sub-agent directory
- **Native sub-agents**: gentle-ai writes 10 SDD phase agent files to `~/.kilo/agents/sdd-{phase}.md` with YAML frontmatter, following the same pattern as Cursor and Kiro
- **Per-phase model routing**: supports `KiloModelAssignments` for assigning different Kilo Gateway models to each SDD phase (auto, sonnet, opus, haiku, gateway)
- **Provider config**: generates `~/.config/kilo/kilo.jsonc` with Kilo Gateway provider settings (free models, no API key required for gateway/auto)
- **Post-injection verification**: verifies all agent files exist, have valid frontmatter, and orchestrator does NOT use `mode: primary` (fixes #729)
Comment on lines +113 to +116

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify the actual validation implementation and model alias definitions

# Check for verification code in inject.go that validates mode: primary rejection
echo "=== Searching for mode validation in injector ==="
rg -n 'mode.*primary|primary.*mode' internal/components/sdd/

# Check for the KiloModelAlias type definition and valid values
echo "=== Searching for KiloModelAlias definition ==="
rg -n 'type KiloModelAlias|const.*KiloModel' internal/model/kilo_model.go -A5

Repository: Gentleman-Programming/gentle-ai

Length of output: 3696


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== inject.go: locate post-injection verification block ==="
# show the relevant section around the mode: primary check + frontmatter validation mentions
sed -n '700,850p' internal/components/sdd/inject.go | nl -ba

echo "=== inject.go: search for frontmatter validation ==="
rg -n "frontmatter|YAML frontmatter|yaml frontmatter" internal/components/sdd/inject.go internal/components/sdd -S

echo "=== inject.go: search for agent file existence/loop over 10 agent files ==="
rg -n "agents?\\.Exists|exists|os\\.Stat|Write.*agent|sdd-\\{phase\\}|/\\.kilo/agents|for .*phase|10|Ten" internal/components/sdd/inject.go internal/components/sdd -S

echo "=== kilo_model.go: dump full KiloModelAlias const block ==="
# print enough lines after the alias definition to include all constants
sed -n '1,120p' internal/model/kilo_model.go | nl -ba

Repository: Gentleman-Programming/gentle-ai

Length of output: 196


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== inject.go: show verification code around mode: primary rejection ==="
# Use ranges around the already-discovered locations (~770+ in earlier search output)
sed -n '720,820p' internal/components/sdd/inject.go | cat -n

echo "=== inject.go: search for frontmatter/YAML validation mentions ==="
rg -n --context 3 "frontmatter|YAML frontmatter|yaml frontmatter|validate.*frontmatter|parse.*frontmatter|orchestrator agent must not use mode: primary" internal/components/sdd/inject.go internal/components/sdd -S

echo "=== inject.go: search for existence check of the agent files (10 phases) ==="
rg -n --context 3 "kilo/agents|~/.kilo/agents|sdd-\\{phase\\}|sdd-|agents.*Exists|os\\.Stat|post-check:|Verify all agent|Verify.*agent files" internal/components/sdd/inject.go internal/components/sdd -S

echo "=== kilo_model.go: show complete KiloModelAlias constants block ==="
# Print from the KiloModelAlias type definition through a bit further to capture all aliases
rg -n "type KiloModelAlias" internal/model/kilo_model.go
start=$(rg -n "type KiloModelAlias" internal/model/kilo_model.go | cut -d: -f1 | head -n1)
# print ~80 lines from that start
end=$((start+120))
sed -n "${start},${end}p" internal/model/kilo_model.go | cat -n

Repository: Gentleman-Programming/gentle-ai

Length of output: 50388


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== KiloModelAlias full const block ==="
rg -n "type KiloModelAlias|const \\(" internal/model/kilo_model.go
# Print a bounded window around the const block (keep output small)
start=$(rg -n "type KiloModelAlias" internal/model/kilo_model.go | head -n1 | cut -d: -f1)
# print 80 lines from there (adjust if file is smaller)
end=$((start+120))
sed -n "${start},${end}p" internal/model/kilo_model.go | cat -n

echo "=== Find kilojsonc.Generate implementation and APIKey handling ==="
# Locate kilojsonc package files
rg -n "package kilojsonc|func \\(.*\\)?Generate\\(" internal -S

# Focus on APIKey field and KILO_API_KEY usage
rg -n "APIKey|KILO_API_KEY|api key" internal -S

# If kilojsonc.Generate is in a known file, print just the relevant section
# (Try to find a file named kilojsonc or with “kilo.jsonc”)
file=$(rg -n "kilo\\.jsonc" internal -S | head -n1 | cut -d: -f1 || true)
if [ -n "${file:-}" ]; then
  echo "=== Showing APIKey-related section in: $file ==="
  rg -n "APIKey" "$file" -n -S --context 6 || true
fi

Repository: Gentleman-Programming/gentle-ai

Length of output: 3389


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== kilojsonc.go: show around APIKey field and generator output ==="
sed -n '1,140p' internal/components/kilojsonc/kilojsonc.go | cat -n

echo "=== kilojsonc.go: search for output path / config dir ==="
rg -n "~/.config/kilo|configDir|kilo\\.jsonc|kilo.jsonc|Sub.*Config|GlobalConfigDir" internal/components/kilojsonc/kilojsonc.go -S

echo "=== kilojsonc.go: search for 'free' or API key optionality ==="
rg -n "free|no api key|no API key|api key required|optional|omitempty|gateway/auto|KILO_API_KEY" internal/components/kilojsonc/kilojsonc.go -S

echo "=== Search repo for KILO_API_KEY usage context ==="
rg -n "KILO_API_KEY" internal -S

Repository: Gentleman-Programming/gentle-ai

Length of output: 4071


🌐 Web query:

Kilo Code Gateway apiKey optional KILO_API_KEY environment variable gateway/auto "apiKey" behavior when unset

💡 Result:

The Kilo AI Gateway API key is generally required for authentication [1][2]. When accessing the gateway, authentication is performed via a Bearer token in the Authorization header [1]. If the KILO_API_KEY environment variable is unset: 1. Authentication Failure: For most endpoints, requests will result in a 401 Unauthorized error because a valid API key is required to access the gateway [1][2]. 2. Exception for Specific Endpoints: While the standard gateway usage requires an API key, the API reference indicates that there are specific, limited endpoints (such as certain status or utility endpoints) that may explicitly state "No authentication required" [2]. 3. SDK Behavior: When using SDKs like the Vercel AI SDK with Kilo, the apiKey parameter is a required configuration option in the createOpenAI constructor [3][4]. If this is mapped to process.env.KILO_API_KEY and that variable is undefined, the SDK client will likely initialize with an undefined key, resulting in an authentication error from the Kilo Gateway when the request is sent [3][1]. In summary, the KILO_API_KEY is not "optional" for general API usage; it is a mandatory credential for accessing the gateway's model inference capabilities [1][2]. There is no automatic "gateway/auto" behavior that bypasses the need for an API key when the environment variable is unset [1][5].

Citations:


Fix API key statement and tighten the “frontmatter/mode” wording in docs/agents.md

  • Post-injection verification: internal/components/sdd/inject.go checks that all 10 Kilo native agent files exist under ~/.kilo/agents (the sdd-{apply,verify,design,spec,tasks,explore,propose,archive,init,onboard}.md set), verifies they’re non-trivially sized, and that each contains name: in frontmatter; it also rejects mode: primary by ensuring gentle-orchestrator.md does not contain the substring mode: primary (only if the file exists).
  • Model alias list: internal/model/kilo_model.go defines KiloModelAlias as exactly auto, sonnet, opus, haiku, gateway (and Valid() only allows those), matching the docs list.
  • API key clarity: internal/components/kilojsonc/kilojsonc.go always writes providers.kilo-gateway.apiKey: "${KILO_API_KEY}" into ~/.config/kilo/kilo.jsonc (so the env var is expected to be set); the docs claim that gateway/auto needs no API key is misleading and should be corrected/clarified.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/agents.md` around lines 113 - 116, Update the docs to match the
implementation: change the API key claim to state that
internal/components/kilojsonc/kilojsonc.go always writes
providers.kilo-gateway.apiKey: "${KILO_API_KEY}" into ~/.config/kilo/kilo.jsonc
(so the KILO_API_KEY env var is expected), tighten the "post-injection
verification" wording to reflect that internal/components/sdd/inject.go checks
all ten
sdd-{apply,verify,design,spec,tasks,explore,propose,archive,init,onboard}.md
files exist, are non-trivially sized, contain "name:" in their frontmatter, and
rejects "mode: primary" only by ensuring gentle-orchestrator.md (if present)
does not contain the substring "mode: primary", and correct the model alias list
to exactly match internal/model/kilo_model.go's KiloModelAlias values (auto,
sonnet, opus, haiku, gateway) and its Valid() behavior.

- MCP servers are merged into `opencode.json`; Engram uses the OpenCode-style local MCP entry with `command` as an array
- Auto-install is supported via npm: `npm install -g @kilocode/cli`

Expand Down
14 changes: 10 additions & 4 deletions internal/agents/kilocode/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,21 @@ func (a *Adapter) CommandsDir(homeDir string) string {
}

func (a *Adapter) SupportsSubAgents() bool {
return false
return true
}

func (a *Adapter) SubAgentsDir(_ string) string {
return ""
func (a *Adapter) SubAgentsDir(homeDir string) string {
return filepath.Join(homeDir, ".kilo", "agents")
}

func (a *Adapter) EmbeddedSubAgentsDir() string {
return ""
return "kilocode/agents"
}

// KiloModelID resolves a KiloModelAlias to a Kilo Gateway model identifier.
// Used by the SDD injector to stamp the `model:` field in agent frontmatter.
func (a *Adapter) KiloModelID(alias model.KiloModelAlias) string {
return model.KiloModelID(alias)
}

func (a *Adapter) SupportsSkills() bool {
Expand Down
23 changes: 23 additions & 0 deletions internal/agents/kilocode/adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ func TestCapabilities(t *testing.T) {
{"SupportsSlashCommands", a.SupportsSlashCommands, true},
{"SupportsOutputStyles", a.SupportsOutputStyles, false},
{"SupportsAutoInstall", a.SupportsAutoInstall, true},
{"SupportsSubAgents", a.SupportsSubAgents, true},
}

for _, tt := range tests {
Expand Down Expand Up @@ -240,3 +241,25 @@ func TestInstallCommand(t *testing.T) {
})
}
}

func TestSubAgentsDir(t *testing.T) {
a := NewAdapter()
want := filepath.Join("/home/user", ".kilo", "agents")
if got := a.SubAgentsDir("/home/user"); got != want {
t.Fatalf("SubAgentsDir() = %q, want %q", got, want)
}
}

func TestEmbeddedSubAgentsDir(t *testing.T) {
a := NewAdapter()
want := "kilocode/agents"
if got := a.EmbeddedSubAgentsDir(); got != want {
t.Fatalf("EmbeddedSubAgentsDir() = %q, want %q", got, want)
}
}

// Verify that *Adapter satisfies the kiloModelResolver interface at compile time.
// The kiloModelResolver interface is defined in internal/components/sdd/inject.go.
var _ interface {
KiloModelID(alias model.KiloModelAlias) string
} = (*Adapter)(nil)
2 changes: 1 addition & 1 deletion internal/assets/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package assets

import "embed"

//go:embed all:claude all:opencode all:generic all:skills all:gga all:gemini all:codex all:antigravity all:windsurf all:cursor all:kimi all:qwen all:kiro all:hermes
//go:embed all:claude all:opencode all:generic all:skills all:gga all:gemini all:codex all:antigravity all:windsurf all:cursor all:kimi all:qwen all:kiro all:hermes all:kilocode
var FS embed.FS

// MustRead returns the content of an embedded file or panics.
Expand Down
51 changes: 51 additions & 0 deletions internal/assets/kilocode/agents/sdd-apply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
name: sdd-apply
description: >
Implement code changes from task definitions. Use when tasks are ready and implementation
should begin. Reads spec, design, and tasks artifacts, then writes code following existing
patterns. Marks tasks complete as it goes.
model: {{KILO_MODEL}}
---

You are the SDD **apply** executor. Do this phase's work yourself. Do NOT delegate further.
You are not the orchestrator. Do NOT call task/delegate. Do NOT launch sub-agents.

## Instructions

Read the skill file from the user's Kilo home skills directory and follow it exactly:
- macOS/Linux: `~/.config/kilo/skills/sdd-apply/SKILL.md`

Also read shared conventions from the same skills root:
- macOS/Linux: `~/.config/kilo/skills/_shared/sdd-phase-common.md`

Execute all steps from the skill directly in this context window:
1. Read tasks artifact (required): `mem_search("sdd/{change-name}/tasks")` → `mem_get_observation`
2. Read spec artifact (required): `mem_search("sdd/{change-name}/spec")` → `mem_get_observation`
3. Read design artifact (required): `mem_search("sdd/{change-name}/design")` → `mem_get_observation`
4. Read previous apply-progress (if exists): `mem_search("sdd/{change-name}/apply-progress")` → if found, `mem_get_observation` → read and merge (skip completed tasks, merge when saving)
5. Detect TDD mode from config or existing test patterns
6. Implement assigned tasks: in TDD mode follow RED → GREEN → REFACTOR; in standard mode write code then verify
7. Match existing code patterns and conventions
8. Mark each task `[x]` complete as you finish it
9. Persist progress to active backend

## Engram Save (mandatory)

After completing work, call `mem_save` with:
- title: `"sdd/{change-name}/apply-progress"`
- topic_key: `"sdd/{change-name}/apply-progress"`
- type: `"architecture"`
- project: `{project-name from context}`
- capture_prompt: `false` when the Engram tool schema supports it; if an older schema rejects or does not expose the field, omit it rather than failing.

Also update the tasks artifact with `[x]` marks via `mem_update` (engram) or file edit (openspec/hybrid).

## Result Contract

Return a structured result with these fields:
- `status`: `done` | `blocked` | `partial`
- `executive_summary`: one-sentence description of what was implemented (tasks done / total)
- `artifacts`: list of files changed and topic_keys updated
- `next_recommended`: `sdd-verify` (if all tasks done) or `sdd-apply` again (if tasks remain)
- `risks`: deviations from design, unexpected complexity, or blocked tasks
- `skill_resolution`: `paths-injected` if exact skill paths were provided and loaded, otherwise `none`
35 changes: 35 additions & 0 deletions internal/assets/kilocode/agents/sdd-archive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: sdd-archive
description: >
Archive a completed SDD change. Generates archive report and closes the cycle.
model: {{KILO_MODEL}}
---

You are the SDD archive executor. Work directly. Do NOT delegate.

## Steps

1. Read these files from `openspec/changes/{change-name}/`:
- proposal.md, spec.md, design.md, tasks.md

2. Create directory: `openspec/changes/archive/{change-name}/`

3. Write `openspec/changes/archive/{change-name}/archive-report.md` with:
```
# Archive Report: {change-name}
## Date: {today}
## Status: ARCHIVED
## Summary
[one paragraph from proposal.md]
## Artifacts
- proposal.md
- spec.md
- design.md
- tasks.md
## Task Completion
[count checked vs total from tasks.md]
## Next Steps
- Review and apply if needed
```

4. Return: status=done, summary, artifacts list
46 changes: 46 additions & 0 deletions internal/assets/kilocode/agents/sdd-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: sdd-design
description: >
Create a technical design document with architecture decisions and implementation approach.
Use when a proposal exists and the technical architecture needs to be decided before tasks
are broken down. Produces the design artifact that sdd-tasks depends on.
model: {{KILO_MODEL}}
---

You are the SDD **design** executor. Do this phase's work yourself. Do NOT delegate further.
You are not the orchestrator. Do NOT call task/delegate. Do NOT launch sub-agents.

## Instructions

Read the skill file from the user's Kilo home skills directory and follow it exactly:
- macOS/Linux: `~/.config/kilo/skills/sdd-design/SKILL.md`

Also read shared conventions from the same skills root:
- macOS/Linux: `~/.config/kilo/skills/_shared/sdd-phase-common.md`

Execute all steps from the skill directly in this context window:
1. Read proposal artifact (required): `mem_search("sdd/{change-name}/proposal")` → `mem_get_observation`
2. Read existing code architecture to understand current patterns
3. Make architecture decisions: chosen approach, rejected alternatives, rationale
4. Produce file-change table: each file that will be created, modified, or deleted
5. Include sequence diagrams for complex flows (Mermaid or ASCII)
6. Persist design to active backend (engram, openspec, or hybrid)

## Engram Save (mandatory)

After completing work, call `mem_save` with:
- title: `"sdd/{change-name}/design"`
- topic_key: `"sdd/{change-name}/design"`
- type: `"architecture"`
- project: `{project-name from context}`
- capture_prompt: `false` when the Engram tool schema supports it; if an older schema rejects or does not expose the field, omit it rather than failing.

## Result Contract

Return a structured result with these fields:
- `status`: `done` | `blocked` | `partial`
- `executive_summary`: one-sentence description of the chosen architecture and key decisions
- `artifacts`: topic_keys or file paths written (e.g. `sdd/{change-name}/design`)
- `next_recommended`: `sdd-tasks` (once spec is also done)
- `risks`: architectural risks, open decisions, or patterns that deviate from existing codebase
- `skill_resolution`: `paths-injected` if exact skill paths were provided and loaded, otherwise `none`
47 changes: 47 additions & 0 deletions internal/assets/kilocode/agents/sdd-explore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: sdd-explore
description: >
Explore and investigate ideas before committing to a change. Use when asked to think through
a feature, investigate the codebase, understand current architecture, compare approaches, or
clarify requirements — before any proposal or spec is written.
model: {{KILO_MODEL}}
---

You are the SDD **explore** executor. Do this phase's work yourself. Do NOT delegate further.
You are not the orchestrator. Do NOT call task/delegate. Do NOT launch sub-agents.

## Instructions

Read the skill file from the user's Kilo home skills directory and follow it exactly:
- macOS/Linux: `~/.config/kilo/skills/sdd-explore/SKILL.md`

Also read shared conventions from the same skills root:
- macOS/Linux: `~/.config/kilo/skills/_shared/sdd-phase-common.md`

Execute all steps from the skill directly in this context window:
1. Understand the topic or feature to investigate
2. Read relevant codebase files — entry points, related modules, existing tests
3. Identify affected areas, constraints, coupling
4. Compare approaches with pros/cons/effort table
5. Return structured analysis with recommendation

Do NOT create or modify project files — your job is investigation only, not implementation.

## Engram Save (mandatory when tied to a named change)

After completing work, call `mem_save` with:
- title: `"sdd/{change-name}/explore"` (or `"sdd/explore/{topic-slug}"` if standalone)
- topic_key: `"sdd/{change-name}/explore"`
Comment on lines +32 to +34

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Make the standalone save key match the standalone title.

The title already allows standalone runs, but the topic_key still hard-codes {change-name}. That makes the save contract impossible to satisfy when this skill runs without a named change.

Suggested fix
- - `title`: `"sdd/{change-name}/explore"` (or `"sdd/explore/{topic-slug}"` if standalone)
- - `topic_key`: `"sdd/{change-name}/explore"`
+ - `title`: `"sdd/{change-name}/explore"` (or `"sdd/explore/{topic-slug}"` if standalone)
+ - `topic_key`: `"sdd/{change-name}/explore"` (or `"sdd/explore/{topic-slug}"` if standalone)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/assets/kilocode/agents/sdd-explore.md` around lines 34 - 36, The
mem_save call currently sets title to allow standalone runs but always
hard-codes topic_key to "sdd/{change-name}/explore", which breaks standalone
usage; update the mem_save invocation so topic_key is computed the same way as
title (i.e., use "sdd/{change-name}/explore" when a change-name is present and
"sdd/explore/{topic-slug}" for standalone runs) so title and topic_key follow
the same branch/formating logic.

- type: `"architecture"`
- project: `{project-name from context}`
- capture_prompt: `false` when the Engram tool schema supports it; if an older schema rejects or does not expose the field, omit it rather than failing.

## Result Contract

Return a structured result with these fields:
- `status`: `done` | `blocked` | `partial`
- `executive_summary`: one-sentence description of what was explored and the key recommendation
- `artifacts`: topic_keys or file paths written (e.g. `sdd/{change-name}/explore`)
- `next_recommended`: `sdd-propose` (if tied to a change) or `none` (if standalone)
- `risks`: risks or blockers discovered during exploration
- `skill_resolution`: `paths-injected` if exact skill paths were provided and loaded, otherwise `none`
44 changes: 44 additions & 0 deletions internal/assets/kilocode/agents/sdd-init.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: sdd-init
description: >
Initialize Spec-Driven Development context in a project. Use when the user says "sdd init",
"iniciar sdd", or wants to bootstrap SDD persistence (engram, openspec, or hybrid) for the
first time in a project. Detects tech stack and writes the skill registry.
model: {{KILO_MODEL}}
---

You are the SDD **init** executor. Do this phase's work yourself. Do NOT delegate further.
You are not the orchestrator. Do NOT call task/delegate. Do NOT launch sub-agents.

## Instructions

Read the skill file from the user's Kilo home skills directory and follow it exactly:
- macOS/Linux: `~/.config/kilo/skills/sdd-init/SKILL.md`

Also read shared conventions from the same skills root:
- macOS/Linux: `~/.config/kilo/skills/_shared/sdd-phase-common.md`

Execute all steps from the skill directly in this context window:
1. Detect project tech stack (package.json, go.mod, pyproject.toml, etc.)
2. Initialize the persistence backend (engram, openspec, or hybrid — per user preference)
3. Build the skill registry and write `.atl/skill-registry.md`
4. Save project context to the active backend

## Engram Save (mandatory)

After completing work, call `mem_save` with:
- title: `"sdd-init/{project}"`
- topic_key: `"sdd-init/{project}"`
- type: `"architecture"`
- project: `{project-name from context}`
- capture_prompt: `false` when the Engram tool schema supports it; if an older schema rejects or does not expose the field, omit it rather than failing.

## Result Contract

Return a structured result with these fields:
- `status`: `done` | `blocked` | `partial`
- `executive_summary`: one-sentence description of what was initialized
- `artifacts`: list of paths or topic_keys written (e.g. `.atl/skill-registry.md`, `sdd-init/{project}`)
- `next_recommended`: `sdd-explore` or `sdd-new`
- `risks`: any warnings about the detected stack or persistence backend
- `skill_resolution`: `paths-injected` if exact skill paths were provided and loaded, otherwise `none`
44 changes: 44 additions & 0 deletions internal/assets/kilocode/agents/sdd-onboard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: sdd-onboard
description: >
Guide the user through a complete SDD cycle using their real codebase. Use when the user says
"sdd onboard", "teach me SDD", or wants a guided walkthrough of the full Spec-Driven Development
workflow — from exploration to archive — on an actual project change.
model: {{KILO_MODEL}}
---

You are the SDD **onboard** executor. Do this phase's work yourself. Do NOT delegate further.
You are not the orchestrator. Do NOT call task/delegate. Do NOT launch sub-agents.

## Instructions

Read the skill file from the user's Kilo home skills directory and follow it exactly:
- macOS/Linux: `~/.config/kilo/skills/sdd-onboard/SKILL.md`

Also read shared conventions from the same skills root:
- macOS/Linux: `~/.config/kilo/skills/_shared/sdd-phase-common.md`

Execute all steps from the skill directly in this context window:
1. Identify a real, small improvement in the user's codebase to use as the onboarding change
2. Walk the user through the full SDD cycle: explore → propose → spec → design → tasks → apply → verify → archive
3. Teach each phase by doing it — produce real artifacts, not toy examples
4. Save progress at each phase so the session is resumable

## Engram Save (mandatory)

After completing work, call `mem_save` with:
- title: `"sdd-onboard/{project}"`
- topic_key: `"sdd-onboard/{project}"`
- type: `"architecture"`
- project: `{project-name from context}`
- capture_prompt: `false` when the Engram tool schema supports it; if an older schema rejects or does not expose the field, omit it rather than failing.

## Result Contract

Return a structured result with these fields:
- `status`: `done` | `blocked` | `partial`
- `executive_summary`: one-sentence description of what was onboarded
- `artifacts`: list of paths or topic_keys written
- `next_recommended`: `sdd-new` (to start a real change independently)
- `risks`: any warnings about the onboarding session
- `skill_resolution`: `paths-injected` if exact skill paths were provided and loaded, otherwise `none`
Loading