Skip to content

feat(vscode): skill-backed @ctx participant, verified against the real CLI - #178

Draft
bilersan wants to merge 2 commits into
ActiveMemory:mainfrom
bilersan:feat/vscode-skill-backed-participant
Draft

bilersan wants to merge 2 commits into
ActiveMemory:mainfrom
bilersan:feat/vscode-skill-backed-participant

Conversation

@bilersan

Copy link
Copy Markdown
Contributor

feat(vscode): skill-backed @ctx participant, verified against the real CLI

Closes #127. Reworks #128 (closed for rework) onto current main, addressing every
point of that review. Opened as a draft because the skill-command design changed
(see Design questions) and I'd like your read on it before a full review.

Spec: specs/vscode-skill-backed-participant.md (committed on-branch; it contains the
full #128 review-point table).

Why now

main's @ctx participant is currently dead: every call passes --no-color, which the
CLI no longer accepts (30 call sites), so each command prints cobra usage instead of
output. package.json also declares /hook and /diag, which nothing dispatches, while
/setup is dispatched but not declared.

What ships

  • 27 CLI-backed commands re-targeted to the current tree: <noun> add with
    --session-id/--branch/--commit provenance, journal source, hook notify|message|pause|resume,
    index, sysinfo, usage, task complete|archive|snapshot, …
  • 9 skill-backed commands (/brainstorm /spec /implement /next /remember /reflect /wrap-up /blog /consolidate) send the canonical ctx-<name> SKILL.md (bundled at build
    time) to the chat model, grounded in ctx agent output and #file attachments. The model
    proposes commands; it cannot run them and never claims to.
  • runCtx: no shell (fixes Windows argument splitting and & command injection), stdin
    closed, exit code surfaced; non-zero exits render as failures, never as results; cancel,
    timeout, spawn failure and output overflow are errors.
  • Parity guard (the core of the feat(vscode): skill-backed chat participant (45 commands) #128 review): commandParity.test.ts drives every command
    branch through the handler and snapshots each ctx argv to src/ctx-cli-surface.json;
    internal/bootstrap/vscode_surface_test.go validates every argv against the cobra tree,
    actually runs the entry add calls in a scratch project, and checks each referenced skill
    ships — so a CLI rename now fails go test. Seeded with 14 of feat(vscode): skill-backed chat participant (45 commands) #128's dead calls and 2
    missing skills, it catches all of them. Refresh: npx vitest run -u in editors/vscode,
    review the diff, rerun the Go test.
  • Reminder bell reads ctx remind list (and no longer refreshes before the binary resolves);
    /pause /resume → hook pause|resume; pre-init gate removed (the CLI decides); commands
    use the active editor's workspace folder in multi-root windows.
  • Removed: /prompt /dep /reindex (CLI gone), /loop, /site. Not carried over from
    feat(vscode): skill-backed chat participant (45 commands) #128: /verify /audit (no shipped skill), /map /check-links /changelog /worktree
    (need repo browsing / git the participant can't do; ctx-architecture also still references
    the removed ctx deps). Guardrails / terminal capture from feat(vscode): skill-backed chat participant (45 commands) #128 are not included.
  • Version 0.10.0 (CHANGELOG "0.10.0 - Unreleased"); the 0.9.0 section is byte-identical.

Verification

  • editors/vscode: npm ci, build, tsc (default + tsconfig.ci.json), eslint,
    vitest 82/82, vsce package — all green.
  • Go: new tests pass; full go test ./... failure roster identical before/after on Windows
    (pre-existing Windows-only failures), go vet clean, golangci-lint v2.13.2 0 issues.
  • Every recorded argv executed against a fresh ctx build in a scratch project.
  • Manually tested the packaged .vsix in VS Code 1.139.1 and VS Code Insiders 1.140.0
    on Windows against a scratch ctx init project.

Design questions for you

  1. Skill-backed commands: OK to send the real SKILL.md to the chat model (read-only,
    proposes commands) instead of feat(vscode): skill-backed chat participant (45 commands) #128's TypeScript re-implementations?
  2. Dropped wishlist commands (/verify /audit /map /check-links /changelog
    /worktree): drop, or keep as follow-ups once the participant can use tools?
  3. Version: hack/release.sh rewrites the extension version to ctx's VERSION at release,
    which would move 0.10.0 back to 0.9.x — keep 0.10.0 "Unreleased" or let the release sync it?
  4. /add task has no --section default because the CLI refuses a catch-all section —
    fine, or should the participant pick one?
  5. Session ID: VS Code exposes no AI session id, so --session-id uses the first 8 chars
    of vscode.env.sessionId. Acceptable?
  6. Test location: the Go parity test reads editors/vscode/src/ctx-cli-surface.json —
    fine in internal/bootstrap, or would you prefer it elsewhere?

Noticed while reconciling (not changed here): task add / convention add help and skills
call --section optional but the CLI requires it; pad edit's doc comment says it opens
$EDITOR, the code doesn't.

🤖 Generated with Claude Code

Reworks the closed ActiveMemory#128 onto current main. The participant on main
is dead on arrival: every invocation passes --no-color, which the CLI
no longer has, and recall/add/notify/system/pause/resume/reindex/
prompt/dep/loop no longer match the command tree. ActiveMemory#128 fixed some of
that but left dead commands of its own (decision/learning reindex,
bare `ctx decision`, split multi-word arguments) and re-implemented
skills in TypeScript against file formats ctx no longer uses.

CLI-backed commands (27) now build argv for the current tree: noun-
verb `<type> add` with provenance filled in (VS Code session ID, git
branch and commit), `journal source`, `hook notify|message|pause|
resume`, `sysinfo`, `usage`, `index .context/DECISIONS.md`, and so on.
runCtx runs without a shell (prompt text on Windows split arguments
and `&` ran a second command), closes stdin so a prompting command
fails fast, and returns the exit code; one runAndRender shows any
non-zero exit as a failure with the CLI's own message.

Skill-backed commands (9: brainstorm, spec, implement, next,
remember, reflect, wrap-up, blog, consolidate) send the canonical
ctx-<name> SKILL.md, bundled from internal/assets/claude/skills at
build time, to the chat model together with `ctx agent` output,
skill-specific read-only ctx output, earlier turns of the same skill,
and #file attachments. The model proposes commands; it cannot run
them and is told never to claim it did. Only skill exchanges are sent
back to the model, so /pad or /notify input never is.

Guard: commandParity.test.ts checks package.json against the
dispatch tables, drives every command branch through the chat
handler, and snapshots each ctx argv to src/ctx-cli-surface.json.
internal/bootstrap/vscode_surface_test.go parses every recorded argv
against the real cobra tree (unknown command, flag, or subcommand;
bad positional args), runs the entry adds in a scratch project, and
checks each bundled skill still ships, so a CLI rename fails go test.

Also: natural-language routing reaches only read-only commands; the
init gate is gone (the CLI decides, and failures point at /init); the
save watcher (its hook exits silently without stdin), commit and
dependency popups, and heartbeat file are dropped; /notify setup sends
the user to a terminal so the webhook URL stays out of chat;
multi-root windows use the active editor's folder. Version 0.10.0;
the released 0.9.0 changelog section is unchanged.

Refs ActiveMemory#127, ActiveMemory#128.

Spec: specs/vscode-skill-backed-participant.md
Signed-off-by: Ersan Bilik <ersanbilik@gmail.com>
The VS Code page, the Copilot integration section, and the multi-tool
recipe still described the unlanded 45-command participant: file-save
and git-commit hooks, a heartbeat, Copilot instructions regenerated on
every .context/ change, /verify, /map, and /wrapup. Describe what
ships: 27 CLI-backed and 9 skill-backed commands, what the skill
commands can and cannot do, the read-only natural-language routing,
and the reminder bar and session events that remain.

Spec: specs/vscode-skill-backed-participant.md
Signed-off-by: Ersan Bilik <ersanbilik@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VS Code chat participant exposes only CLI commands, not the ctx skill/workflow layer

1 participant