Skip to content
Draft
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
90 changes: 44 additions & 46 deletions docs/home/vscode.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Install the extension and the `ctx` binary, then `ctx init` your project:
| File | Purpose |
|------|---------|
| `.context/` | Project-local context directory (created by `ctx init`) |
| `.github/copilot-instructions.md` | Repository instructions Copilot reads natively; regenerated automatically whenever `.context/` files change |
| `.github/copilot-instructions.md` | Repository instructions Copilot reads natively; written by `@ctx /init` (`ctx setup copilot --write`) |

The extension itself lives in VS Code's extension storage. No project
files are added beyond `.context/` and the Copilot instructions.
Expand All @@ -79,88 +79,86 @@ files are added beyond `.context/` and the Copilot instructions.
Type `@ctx` in the Copilot Chat view to invoke the chat participant.
Then either:

- **Use a slash command:** `@ctx /status`, `@ctx /wrapup`, etc. There
are 45 commands; the most common ones live in the [Slash Commands](#slash-commands)
- **Use a slash command:** `@ctx /status`, `@ctx /wrap-up`, etc. There
are 36 commands; the most common ones live in the [Slash Commands](#slash-commands)
table below.
- **Use natural language:** `@ctx what should I work on?` routes to
`/next`; `@ctx time to wrap up` routes to `/wrapup`. See
`/next`; `@ctx time to wrap up` routes to `/wrap-up`. See
[Natural Language](#natural-language).

The extension shows context-aware follow-up suggestions after each
command. For example, after `/init` you'll see buttons for "Show
status" or "Generate copilot integration."
command. For example, after `/init` you'll see "Show context status"
or "What should I work on next?"

## What Happens Automatically

The extension registers several VS Code event handlers that mirror
Claude Code's hook system. These run in the background; no user action
The extension does a few things in the background; no user action
needed.

| Trigger | What fires |
|---------|------------|
| **File save** | Task-completion check on non-`.context/` files |
| **Git commit** | Notification prompting to add a Decision, Learning, run `/verify`, or Skip |
| **`.context/` file change** | Refreshes pending reminders and regenerates `.github/copilot-instructions.md` |
| **Dependency file change** | When `go.mod`, `package.json`, etc. change, prompts to refresh the dependency map (`/map`) |
| **Every 5 minutes** | Updates the reminder status-bar item and writes a heartbeat timestamp |
| **Extension activate** | Fires `ctx system session-event --type start` |
| **Extension deactivate** | Fires `ctx system session-event --type end` |
| **Extension activate** | `ctx system session-event --type start` |
| **`/init` succeeds** | The same session start (activation found no `.context/` yet) |
| **`.context/` file change, and every 5 minutes** | Refreshes the reminder status bar from `ctx remind list` (read-only) |
| **Extension deactivate** | `ctx system session-event --type end` |

### Status Bar

A `$(bell) ctx` indicator appears in the status bar when you have
pending reminders. It refreshes every 5 minutes and hides itself when
nothing is due.
A `$(bell) ctx` indicator appears in the status bar while `ctx remind
list` has pending reminders, and hides itself when the list is empty.

## Slash Commands

The extension surfaces 45 commands across six categories. The most
commonly used:
The extension surfaces 36 commands. 27 run the `ctx` CLI and render its
output; a command that exits non-zero is shown as a failure with the
CLI's own message. 9 run a canonical `ctx` skill through the chat model.
The most commonly used:

### Core Context

| Command | When to use |
|---------|-------------|
| `/init` | Initialize a `.context/` directory with template files |
| `/init` | Initialize a `.context/` directory and the Copilot instructions |
| `/status` | Token estimate, file count, what's recent |
| `/agent` | Print AI-ready context packet |
| `/drift` | Detect stale paths, missing files, dead references |
| `/recall` | Browse and search prior AI session history |
| `/add` | Add a task, decision, learning, or convention |
| `/recall` | Browse prior AI session history (`ctx journal source`) |
| `/add` | Add a task, decision, learning, or convention (provenance is filled in) |
| `/decision`, `/learning` | List recorded decisions or learnings |

### Session Lifecycle
### Skill-Backed Workflows

| Command | When to use |
|---------|-------------|
| `/wrapup` | End-of-session ceremony: status, drift, journal audit |
| `/remember` | Structured readback (trigger: "Do you remember?") from tasks, decisions, learnings, recent journal |
| `/reflect` | Surface items worth persisting as decisions or learnings |
| `/pause` / `/resume` | Save and restore session state for later |

### Discovery & Planning
Each runs the `ctx-<name>` skill, grounded in `ctx agent` output and any
file you attach with `#file`. The model proposes commands and edits and
gives you the exact `@ctx` or `ctx` command to run; it never claims to
have run anything.

| Command | When to use |
|---------|-------------|
| `/brainstorm` | Browse and develop ideas from `ideas/` |
| `/spec` | List or scaffold feature specs from templates |
| `/verify` | Run verification (doctor + drift) |
| `/map` | Show dependency map (go.mod, package.json) |

Full list (with maintenance, audit, metadata, and system commands) is
in [editors/vscode/README.md](https://github.com/ActiveMemory/ctx/blob/main/editors/vscode/README.md#slash-commands).
| `/remember` | Structured readback (trigger: "Do you remember?") |
| `/next` | Pick what to work on next |
| `/brainstorm` | Turn a vague idea into a validated design (multi-turn) |
| `/spec` | Draft a feature spec |
| `/implement` | Work through a plan step by step (attach it with `#file`) |
| `/reflect` | Surface what is worth persisting |
| `/wrap-up` | End-of-session review; proposes entries to persist |
| `/blog`, `/consolidate` | Draft a post; propose merges of overlapping entries |

Full list is in
[editors/vscode/README.md](https://github.com/ActiveMemory/ctx/blob/main/editors/vscode/README.md#slash-commands).

## Natural Language

Plain English after `@ctx` is routed to the right command:
Plain English after `@ctx` is routed to a read-only command:

- "Do you remember?" → `/remember`
- "What should I work on next?" → `/next`
- "Time to wrap up" → `/wrapup`
- "Time to wrap up" → `/wrap-up`
- "Show me the status" → `/status`
- "Add a decision" → `/add`
- "Check for drift" → `/drift`

If the phrase doesn't match a known pattern, the extension surfaces a
short menu of likely matches.
A keyword match never changes your context. If the phrase doesn't match,
the extension lists its commands.

## Auto-Bootstrap

Expand Down Expand Up @@ -205,7 +203,7 @@ provide the CLI it shells out to.
|---------|-------|-----|
| `@ctx` participant doesn't appear in Copilot Chat | Copilot Chat not installed or not signed in | Install [GitHub Copilot Chat](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot-chat) and ensure you're signed in to a Copilot-eligible account |
| `@ctx /status` says `ctx` not found | CLI not on PATH and auto-download disabled | Either add `ctx` to PATH (`brew install activememory/tap/ctx` or download from [Releases](https://github.com/ActiveMemory/ctx/releases)), or unset `ctx.executablePath` to let the extension auto-download |
| Status-bar reminder never updates | Heartbeat suppressed or `.context/` doesn't exist | Run `ctx init` from your project root; reload VS Code if the indicator still doesn't appear within 5 minutes |
| Status-bar reminder never appears | `.context/` doesn't exist, or no reminders are pending | Run `ctx init` from your project root, then add one with `@ctx /remind <text>` |
| Commands run but nothing is captured to `.context/` | Workspace folder missing or `.context/` outside the open folder | Make sure your project root (the one with `.context/`) is the workspace root, not a subdirectory of it |

## Verify It Works
Expand All @@ -219,7 +217,7 @@ Open Copilot Chat and ask:
You should see a structured readback citing specific tasks, decisions,
and recent session topics. If you instead see "I don't have memory" or
"Let me check," something went wrong: confirm the CLI is reachable
(`@ctx /system doctor`) and `.context/` has files in it.
(`@ctx /doctor`) and `.context/` has files in it.

## What's Next

Expand Down
18 changes: 9 additions & 9 deletions docs/operations/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -647,10 +647,9 @@ to regenerate the instructions.
### VS Code Chat Extension (`@ctx`)

The **`ctx` VS Code extension** adds a `@ctx` chat participant to
GitHub Copilot Chat, giving you direct access to 45 context commands
from within the editor, plus automatic hooks on file save / git commit /
`.context/` changes / dependency-file edits, and a reminder status-bar
indicator.
GitHub Copilot Chat: 27 commands that run the `ctx` CLI, 9 that run a
canonical `ctx` skill through the chat model (brainstorm, spec, next,
wrap-up, ...), and a reminder status-bar indicator.

!!! tip "Full guide: [`ctx` for VS Code](../home/vscode.md)"
The home-page guide covers daily workflows, the full command list,
Expand Down Expand Up @@ -681,17 +680,18 @@ Reload VS Code. Type `@ctx` in Copilot Chat to verify.
| File | Purpose |
|------|---------|
| `.context/` | Project-local context directory (created by `ctx init`, not by the extension) |
| `.github/copilot-instructions.md` | Repository instructions Copilot reads natively; regenerated automatically when `.context/` files change |
| `.github/copilot-instructions.md` | Repository instructions Copilot reads natively; written by `@ctx /init` (`ctx setup copilot --write`) |

The extension itself lives in VS Code's extension storage; no project
files beyond `.context/` and the Copilot instructions are added.

#### How It Works

- **Chat participant:** `@ctx` is registered with VS Code's Chat API; 45 slash commands route to dedicated handlers that shell out to the `ctx` CLI.
- **Automatic hooks:** file save → task-completion check; git commit → decision/learning prompt; `.context/` change → regenerate Copilot instructions; dependency-file change → `/map` prompt.
- **Status-bar reminder:** a `$(bell) ctx` indicator surfaces pending session reminders, refreshing every 5 minutes.
- **Natural language:** plain English after `@ctx` is routed to the nearest matching command.
- **CLI-backed commands** run the `ctx` CLI (no shell) and render its output; a non-zero exit is shown as a failure with the CLI's message.
- **Skill-backed commands** hand the chat model the canonical `ctx-<name>` skill (bundled from `internal/assets/claude/skills/`), `ctx agent` output, and any `#file` attachments. The model proposes commands and edits; it cannot run them.
- **Session events:** activation and deactivation fire `ctx system session-event`.
- **Status-bar reminder:** a `$(bell) ctx` indicator shows while `ctx remind list` has entries, refreshed on `.context/` changes and every 5 minutes.
- **Natural language:** plain English after `@ctx` is routed to a read-only command.
- **Auto-bootstrap:** if the `ctx` CLI isn't on PATH, the extension downloads the correct platform binary from GitHub Releases and caches it.

#### Configuration
Expand Down
10 changes: 5 additions & 5 deletions docs/recipes/multi-tool-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,11 @@ auto-downloads the `ctx` CLI if it isn't on PATH. See

!!! tip "VS Code Is a First-Class Citizen"
The extension carries its own runtime. No `ctx setup` step is
needed. It registers a `@ctx` chat participant with 45 slash
commands, automatic hooks (file save, git commit, `.context/`
change, dependency-file edit), and a reminder status-bar
indicator. Unlike embedded harnesses, the extension ships
through its own pipeline to the VS Code Marketplace.
needed. It registers a `@ctx` chat participant with 36 slash
commands (27 CLI-backed, 9 running a canonical `ctx` skill
through the chat model) and a reminder status-bar indicator.
Unlike embedded harnesses, the extension ships through its own
pipeline to the VS Code Marketplace.

#### Cursor

Expand Down
58 changes: 58 additions & 0 deletions editors/vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,64 @@ will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/).

## [0.10.0] - Unreleased

### Added

- **Skill-backed commands**: `/brainstorm`, `/spec`, `/implement`,
`/next`, `/remember`, `/reflect`, `/wrap-up`, `/blog`, and
`/consolidate` each run the canonical `ctx-<name>` skill through the
chat model. The skill text is bundled from
`internal/assets/claude/skills/` at build time; each request is
grounded in `ctx agent` output, the read-only ctx output the skill
relies on, earlier turns of the same skill conversation, and `#file`
attachments. The model proposes commands and edits; it never claims to
have run them. A plain reply after a skill answer continues that skill.
- `/decision` and `/learning` list entries (`ctx index`).
- Reminder status bar: `$(bell) ctx` while `ctx remind list` has entries.
- Session start and end events (`ctx system session-event`) on
activation, after `/init`, and on deactivation.
- **Command-parity guard.** `commandParity.test.ts` checks that
`package.json` declares exactly the dispatched commands, drives every
command branch through the chat handler, and records each `ctx` argv in
`src/ctx-cli-surface.json`. The Go test
`internal/bootstrap/vscode_surface_test.go` parses every recorded argv
against the real command tree, runs the entry `add` invocations, and
checks every bundled skill still ships, so a CLI rename fails CI.

### Fixed

- **Every command targets the current CLI.** All invocations passed the
removed `--no-color` flag, so every command failed. Also reconciled:
`recall list` → `journal source`; `add <type>` → `<type> add` with the
required provenance (`--session-id`, `--branch`, `--commit`);
`notify` → `hook notify`; `system resources` → `sysinfo`;
`system message` → `hook message`; `pause`/`resume` →
`hook pause`/`hook resume`; `/why` with no argument no longer opens the
CLI's interactive menu.
- **Failures are shown as failures.** A non-zero exit renders the CLI's
message under "exited with code N" instead of as a normal result;
cancellation, the 30s timeout, and spawn or buffer failures are
errors, never partial output.
- **No shell on Windows.** Prompt text reached `cmd.exe` unquoted, so a
multi-word argument split apart and `&` ran a second command. The CLI
now runs without a shell, and multi-word values stay one argument
(`/pad edit`, `/notify <message>`, quoted `/add` flag values).
- stdin is closed, so no command waits on a prompt until the timeout.
- Natural-language routing only reaches read-only commands; a keyword
match can no longer complete a task or add a reminder.
- In a multi-root window, commands run in the folder of the active
editor.

### Removed

- `/prompt` and `/dep`: `ctx prompt` and `ctx dep` no longer exist.
- `/reindex`: `ctx reindex` no longer exists; indices are projected on
demand (`/decision`, `/learning`).
- `/loop`: `ctx loop` writes a shell script that drives a terminal agent,
not a chat workflow.
- `/site`: `ctx site` is a hidden maintainer command.

## [0.9.0] - 2026-03-19

### Added
Expand Down
Loading
Loading