Auto-open implementation via Dynamic Context Injection in /os-sdlc:implement #509

Open
opened 2026-08-25 17:56:14 +00:00 by jared · 0 comments
Owner

Context

User concept (approved for capture 2026-08-25): /os-sdlc:implement should use skill Dynamic Context Injection so implementation-open fires automatically at invocation — zero extra tool calls on single-target projects, exactly one on multi-target. Feasibility verified against https://code.claude.com/docs/en/skills#inject-dynamic-context and the repo by a sonnet probe.

Verified constraints that shape the design:

  • Injection is a !command`` line in the skill body (not frontmatter); stdout replaces the placeholder before Claude sees the skill. Non-zero exit ABORTS the whole skill invocation, so needs-info/ambiguous states must print guidance and exit 0.
  • Arguments: $ARGUMENTS available to the injected command; argument-hint frontmatter is autocomplete only, no validation. Ticket parsing (123 / #123 / nil) must be tested Ruby, not shell regex.
  • Real CLI today: os-sdlc-runner implementation-open SESSION_ID TICKET MAP_PATH [--target NAME]; multi-target raises TargetSelectionError listing available targets (lib/os_sdlc/project_targets.rb, open_implementation.rb). cc-os itself is multi-target.
  • plugins/os-sdlc/CLAUDE.md rule: sequencing logic lives in tested Ruby, never in SKILL.md — so the injection calls a NEW read-only runner subcommand (working name injection-context) that never mutates the Db; the skill body branches only on its printed output.

Tasks

  • Add read-only injection-context subcommand to os_sdlc runner CLI: parse ticket arg, load project tolerantly, single-target+ticket → run implementation-open and render opened-state; multi-target and/or missing ticket → render target list + exact implementation-open command and/or ticket request, exit 0 in all guidance states
  • Small tested TicketArg class (number / #number / nil / garbage)
  • implement/SKILL.md: add argument-hint, the injected !...`` line, rewrite Setup steps 1–3 to branch on injected output
  • Unit tests: single-target, multi-target, missing ticket, both missing; exit-code discipline
  • Confirm SESSION_ID source (${CLAUDE_SESSION_ID} substitution vs current plumbing) before wiring
  • /os-adr:find then ADR if this changes a recorded skill/runner boundary

Acceptance criteria

  • Single-target project with ticket arg: implementation open before the first model turn, no extra tool call
  • Multi-target: one injected response lists real targets + the one command to run; missing ticket requested in the same response
  • Ambiguity never aborts the skill (exit 0 paths verified by test)

Out of scope: optional ticket-body parameter for non-issue work (file separately if wanted), changes to implementation-open's signature, gate/routing logic.

Origin

  • Trigger: worktree-finish redesign discussion 2026-08-25; user proposed DCI while reviewing skill/CLI boundaries
  • Improvised this session: none
  • Chain: manual ticket/target round-trips at implement start ← Setup steps are prose asks ← DESIGN (plugins/os-sdlc/skills/implement/SKILL.md)
  • Root candidate: this ticket
## Context User concept (approved for capture 2026-08-25): /os-sdlc:implement should use skill Dynamic Context Injection so implementation-open fires automatically at invocation — zero extra tool calls on single-target projects, exactly one on multi-target. Feasibility verified against https://code.claude.com/docs/en/skills#inject-dynamic-context and the repo by a sonnet probe. Verified constraints that shape the design: - Injection is a `!`command`` line in the skill body (not frontmatter); stdout replaces the placeholder before Claude sees the skill. Non-zero exit ABORTS the whole skill invocation, so needs-info/ambiguous states must print guidance and exit 0. - Arguments: $ARGUMENTS available to the injected command; `argument-hint` frontmatter is autocomplete only, no validation. Ticket parsing (`123` / `#123` / nil) must be tested Ruby, not shell regex. - Real CLI today: `os-sdlc-runner implementation-open SESSION_ID TICKET MAP_PATH [--target NAME]`; multi-target raises TargetSelectionError listing available targets (lib/os_sdlc/project_targets.rb, open_implementation.rb). cc-os itself is multi-target. - plugins/os-sdlc/CLAUDE.md rule: sequencing logic lives in tested Ruby, never in SKILL.md — so the injection calls a NEW read-only runner subcommand (working name `injection-context`) that never mutates the Db; the skill body branches only on its printed output. ## Tasks - [ ] Add read-only `injection-context` subcommand to os_sdlc runner CLI: parse ticket arg, load project tolerantly, single-target+ticket → run implementation-open and render opened-state; multi-target and/or missing ticket → render target list + exact implementation-open command and/or ticket request, exit 0 in all guidance states - [ ] Small tested TicketArg class (number / #number / nil / garbage) - [ ] implement/SKILL.md: add argument-hint, the injected `!`...`` line, rewrite Setup steps 1–3 to branch on injected output - [ ] Unit tests: single-target, multi-target, missing ticket, both missing; exit-code discipline - [ ] Confirm SESSION_ID source (${CLAUDE_SESSION_ID} substitution vs current plumbing) before wiring - [ ] /os-adr:find then ADR if this changes a recorded skill/runner boundary ## Acceptance criteria - [ ] Single-target project with ticket arg: implementation open before the first model turn, no extra tool call - [ ] Multi-target: one injected response lists real targets + the one command to run; missing ticket requested in the same response - [ ] Ambiguity never aborts the skill (exit 0 paths verified by test) Out of scope: optional ticket-body parameter for non-issue work (file separately if wanted), changes to implementation-open's signature, gate/routing logic. ## Origin - Trigger: worktree-finish redesign discussion 2026-08-25; user proposed DCI while reviewing skill/CLI boundaries - Improvised this session: none - Chain: manual ticket/target round-trips at implement start ← Setup steps are prose asks ← DESIGN (plugins/os-sdlc/skills/implement/SKILL.md) - Root candidate: this ticket
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jared/cc-os#509
No description provided.