Advanced Usage
Autonomous workflows, self-correcting callbacks, web research, PDF generation, and tips for getting the most out of Context Pilot.
Autonomous Workflows
Context Pilot can work autonomously — the AI continues working through a todo list without waiting for your input after each step. This is powered by the Spine module.
Setting up autonomous mode
- Create a todo list with
todo_create— break your task into subtasks - Enable auto-continuation:
spine_configure(continue_until_todos_done: true) - Set guard rails to prevent runaway AI:
spine_configure( max_cost: 2.00, // Stop after $2 spent max_messages: 100, // Stop after 100 messages max_duration_secs: 1800, // Stop after 30 minutes max_auto_retries: 20 // Stop after 20 auto-continuations ) - The AI works through todos, marking them done, until all are complete or a guard rail triggers
Monitoring autonomous work
The Spine panel (P7) shows notifications, auto-continuation count, and guard rail status.
Press Esc at any time to stop the AI mid-generation. The Todo panel shows
progress in real-time.
File Edit Callbacks
Callbacks are the secret weapon: bash scripts that automatically fire when the AI edits files matching a glob pattern. They create a self-correcting feedback loop.
Creating a callback
Callback_upsert(
action: "create",
name: "rust-check",
pattern: "*.rs",
script_content: "cargo check 2>&1",
blocking: true,
timeout: 30,
success_message: "Build passed ✓"
)
How it works
- AI edits a
.rsfile viaEditorWrite - The
rust-checkcallback fires automatically - In blocking mode, the AI waits for the result
- If the check fails, the AI sees the error output and self-corrects
- If it passes, the AI sees the success message and continues
Advanced callback features
- Blocking mode — AI pauses until the callback completes
- One-at-a-time — prevents simultaneous runs of the same callback
- Timeout — kills callbacks that run too long
- Exit code 7 — silently suppresses output (for "not applicable" cases)
- skip_callbacks — bypass specific callbacks on individual edits
- $CP_CHANGED_FILES — environment variable with the list of changed files
Web Search & Scraping
With API keys configured, the AI can search the web and scrape pages. Tools follow an escalation tier system — start cheap, go deeper only if needed.
Escalation tiers
| Tier | Tool | When to use |
|---|---|---|
| 1 | brave_search | Quick facts, snippets — always try first |
| 2 | brave_llm_context | Need more depth from search results |
| 3a | firecrawl_scrape | Full page from a known URL |
| 3b | firecrawl_search | Search + scrape in one call |
| 4 | firecrawl_map | Discover URLs on a domain |
Brave Goggles
Load the built-in "Brave Goggles" skill (skill_load("brave-goggles"))
for curated domain re-ranking goggles — tech blogs, HN, academic sources, and more.
PDF Generation
Context Pilot embeds the Typst compiler — create professional PDFs from code without any external tools.
Quick start
# Create a document
Write("report.typ", "#set page(paper: \"a4\")\n= My Report\nHello world")
# Compile to PDF
typst_execute("typst compile report.typ")
# Watch for auto-recompile on edits
typst_execute("typst watch report.typ")
Templates
Reusable templates live in .context-pilot/shared/typst-templates/.
Import them in your documents. You can also scaffold from Typst Universe:
typst_execute("typst init @preview/brilliant-cv:2.0.3")
Presets
Presets save and restore your entire working configuration — switch between different project contexts instantly.
Saving a preset
preset_snapshot_myself(
name: "my-rust-project",
description: "Rust project with clippy callbacks and web search"
)
Loading a preset
preset_load(name: "my-rust-project")
Presets capture: active agent, modules, disabled tools, todos, scratchpad, callbacks, and panel configurations. Messages are preserved.
Power-User Tips
- Use
@autocomplete — type@in the input to get shell-style file path completion with Tab navigation - Create slash commands —
/review,/deploy,/testfor common prompts - Stack callbacks — combine
cargo check(blocking) +cargo clippy(blocking) +cargo test(async) for a full CI pipeline on every edit - Use memories for conventions — "Always use explicit error handling", "Run tests before committing" — the AI follows them every session
- Close stale panels — the AI can close panels to free context space. Ask it to clean up if things feel cluttered
- Use
coucoufor reminders — schedule a notification to check on a long-running process - Conversation history — when context gets large, ask the AI to close old history panels (it preserves important info as logs/memories first)