Tools and Utilities
ctx watch¶
Watch for AI output and auto-apply context updates.
Parses <context-update> XML commands from AI output and applies
them to context files.
Flags:
| Flag | Description |
|---|---|
--log <file> |
Log file to watch (default: stdin) |
--dry-run |
Preview updates without applying |
Example:
# Watch stdin
ai-tool | ctx watch
# Watch a log file
ctx watch --log /path/to/ai-output.log
# Preview without applying
ctx watch --dry-run
ctx hook¶
Generate AI tool integration configuration.
Flags:
| Flag | Short | Description |
|---|---|---|
--write |
-w |
Write the generated config to disk (e.g. .github/copilot-instructions.md) |
Supported tools:
| Tool | Description |
|---|---|
claude-code |
Redirects to plugin install instructions |
cursor |
Cursor IDE |
aider |
Aider CLI |
copilot |
GitHub Copilot |
windsurf |
Windsurf IDE |
Claude Code uses the plugin system
Claude Code integration is now provided via the ctx plugin.
Running ctx hook claude-code prints plugin install instructions.
Example:
# Print hook instructions to stdout
ctx hook cursor
ctx hook aider
# Generate and write .github/copilot-instructions.md
ctx hook copilot --write
ctx loop¶
Generate a shell script for running an autonomous loop.
An autonomous loop continuously runs an AI assistant with the same prompt until a completion signal is detected, enabling iterative development where the AI builds on its previous work.
Flags:
| Flag | Short | Description | Default |
|---|---|---|---|
--tool <tool> |
-t |
AI tool: claude, aider, or generic |
claude |
--prompt <file> |
-p |
Prompt file to use | PROMPT.md |
--max-iterations <n> |
-n |
Maximum iterations (0 = unlimited) | 0 |
--completion <signal> |
-c |
Completion signal to detect | SYSTEM_CONVERGED |
--output <file> |
-o |
Output script filename | loop.sh |
Example:
# Generate loop.sh for Claude Code
ctx loop
# Generate for Aider with custom prompt
ctx loop --tool aider --prompt TASKS.md
# Limit to 10 iterations
ctx loop --max-iterations 10
# Output to custom file
ctx loop -o my-loop.sh
Usage:
See Autonomous Loops for detailed workflow documentation.
ctx notify¶
Send fire-and-forget webhook notifications from skills, loops, and hooks.
Flags:
| Flag | Short | Description |
|---|---|---|
--event |
-e |
Event name (required) |
--session-id |
-s |
Session ID (optional) |
Behavior:
- No webhook configured: silent noop (exit 0)
- Webhook set but event not in
eventslist: silent noop (exit 0) - Webhook set and event matches: fire-and-forget HTTP POST
- HTTP errors silently ignored (no retry)
Example:
ctx notify --event loop "Loop completed after 5 iterations"
ctx notify -e nudge -s session-abc "Context checkpoint at prompt #20"
ctx notify setup¶
Configure the webhook URL interactively. The URL is encrypted with AES-256-GCM
using the encryption key and stored in .context/.notify.enc.
The encrypted file is safe to commit. The key (.context/.context.key) is
gitignored and never committed.
ctx notify test¶
Send a test notification and report the HTTP response status.
Payload format (JSON POST):
{
"event": "loop",
"message": "Loop completed after 5 iterations",
"session_id": "abc123-...",
"timestamp": "2026-02-22T14:30:00Z",
"project": "ctx"
}
| Field | Type | Description |
|---|---|---|
event |
string | Event name from --event flag |
message |
string | Notification message |
session_id |
string | Session ID (omitted if empty) |
timestamp |
string | UTC RFC3339 timestamp |
project |
string | Project directory name |
ctx pad¶
Encrypted scratchpad for sensitive one-liners that travel with the project.
When invoked without a subcommand, lists all entries.
ctx pad add¶
Append a new entry to the scratchpad.
Flags:
| Flag | Short | Description |
|---|---|---|
--file |
-f |
Ingest a file as a blob entry (max 64 KB) |
Examples:
ctx pad add "DATABASE_URL=postgres://user:pass@host/db"
ctx pad add "deploy config" --file ./deploy.yaml
ctx pad show¶
Output the raw text of an entry by number. For blob entries, prints
decoded file content (or writes to disk with --out).
Arguments:
n: 1-based entry number
Flags:
| Flag | Description |
|---|---|
--out |
Write decoded blob content to a file (blobs only) |
Examples:
ctx pad rm¶
Remove an entry by number.
Arguments:
n: 1-based entry number
ctx pad edit¶
Replace, append to, or prepend to an entry.
Arguments:
n: 1-based entry numbertext: Replacement text (mutually exclusive with--append/--prepend)
Flags:
| Flag | Description |
|---|---|
--append |
Append text to the end of the entry |
--prepend |
Prepend text to the beginning of entry |
--file |
Replace blob file content (preserves label) |
--label |
Replace blob label (preserves content) |
Examples:
ctx pad edit 2 "new text"
ctx pad edit 2 --append " suffix"
ctx pad edit 2 --prepend "prefix "
ctx pad edit 1 --file ./v2.yaml
ctx pad edit 1 --label "new name"
ctx pad mv¶
Move an entry from one position to another.
Arguments:
from: Source position (1-based)to: Destination position (1-based)
ctx pad resolve¶
Show both sides of a merge conflict in the encrypted scratchpad.
ctx pad import¶
Bulk-import lines from a file into the scratchpad. Each non-empty line becomes a separate entry. All entries are written in a single encrypt/write cycle.
Arguments:
file: Path to a text file, or-for stdin
Examples:
ctx pad export¶
Export all blob entries from the scratchpad to a directory as files. Each blob's label becomes the filename. Non-blob entries are skipped.
Arguments:
dir: Target directory (default: current directory)
Flags:
| Flag | Short | Description |
|---|---|---|
--force |
-f |
Overwrite existing files instead of timestamping |
--dry-run |
Print what would be exported without writing |
When a file already exists, a unix timestamp is prepended to avoid
collisions (e.g., 1739836200-label). Use --force to overwrite instead.
Examples:
ctx pad merge¶
Merge entries from one or more scratchpad files into the current pad. Each input file is auto-detected as encrypted or plaintext. Entries are deduplicated by exact content.
Arguments:
FILE...: One or more scratchpad files to merge (encrypted or plaintext)
Flags:
| Flag | Short | Description |
|---|---|---|
--key |
-k |
Path to key file for decrypting input files |
--dry-run |
Print what would be merged without writing |
Examples:
ctx pad merge worktree/.context/scratchpad.enc
ctx pad merge notes.md backup.enc
ctx pad merge --key /other/.context.key foreign.enc
ctx pad merge --dry-run pad-a.enc pad-b.md
ctx remind¶
Session-scoped reminders that surface at session start. Reminders are stored verbatim and relayed verbatim — no summarization, no categories.
When invoked with a text argument and no subcommand, adds a reminder.
ctx remind add¶
Add a reminder. This is the default action — ctx remind "text" and
ctx remind add "text" are equivalent.
ctx remind "refactor the swagger definitions"
ctx remind add "check CI after the deploy" --after 2026-02-25
Arguments:
text: The reminder message (verbatim)
Flags:
| Flag | Short | Description |
|---|---|---|
--after |
-a |
Don't surface until this date (YYYY-MM-DD) |
Examples:
ctx remind "refactor the swagger definitions"
ctx remind "check CI after the deploy" --after 2026-02-25
ctx remind list¶
List all pending reminders. Date-gated reminders that aren't yet due
are annotated with (after DATE, not yet due).
Aliases: ls
ctx remind dismiss¶
Remove a reminder by ID, or remove all reminders with --all.
Arguments:
id: Reminder ID (shown inlistoutput)
Flags:
| Flag | Description |
|---|---|
--all |
Dismiss all reminders |
Aliases: rm
Examples:
ctx pause¶
Pause all context nudge and reminder hooks for the current session. Security hooks (dangerous command blocking) and housekeeping hooks still fire.
Flags:
| Flag | Description |
|---|---|
--session-id |
Session ID (overrides stdin) |
Example:
See also: Pausing Context Hooks
ctx resume¶
Resume context hooks after a pause. Silent no-op if not paused.
Flags:
| Flag | Description |
|---|---|
--session-id |
Session ID (overrides stdin) |
Example:
See also: Pausing Context Hooks
ctx completion¶
Generate shell autocompletion scripts.
Subcommands¶
| Shell | Command |
|---|---|
bash |
ctx completion bash |
zsh |
ctx completion zsh |
fish |
ctx completion fish |
powershell |
ctx completion powershell |
Installation¶
ctx why¶
Read ctx's philosophy documents directly in the terminal, stripped of MkDocs artifacts so they display cleanly without a browser.
Documents:
| Name | Description |
|---|---|
manifesto |
The ctx Manifesto — creation, not code |
about |
About ctx — what it is and why it exists |
invariants |
Design invariants — properties that must hold |
Usage: