contextdb-autopilot
ContextDB Autopilot
Overview
Use this skill to run a task with full filesystem context DB automation in one command.
Script path: scripts/ctx-agent.sh
Runtime core: scripts/ctx-agent-core.mjs (single source for sh/mjs wrappers)
When to Use
- You want cross-CLI memory continuity (
codex,claude,gemini,opencode) in the same project. - You need zero-manual context DB operations per task run.
- You want each run to auto-write user event, assistant event, checkpoint, and refreshed context packet.
- You want interactive wrappers to auto-seed route-aware startup prompts so the agent can classify
single/subagent/teamand trigger AIOS route commands without user-entered trigger commands.
Required Pattern
Use one-shot mode (--prompt) for full automation.
scripts/ctx-agent.sh --agent codex-cli --project rex-cli --prompt "继续上次任务,先做最小变更"
scripts/ctx-agent.sh --agent claude-code --project rex-cli --prompt "延续当前会话并输出下一步"
scripts/ctx-agent.sh --agent gemini-cli --project rex-cli --prompt "基于已有上下文继续执行"
scripts/ctx-agent.sh --agent opencode-cli --project rex-cli --prompt "继续当前任务并执行下一步"
Session Control
- Continue same session:
--session <session_id> - Mark terminal step:
--status done - Disable auto bootstrap for current run:
--no-bootstrap - Disable checkpoint (rare):
--no-checkpoint - Disable auto bootstrap globally:
export AIOS_BOOTSTRAP_AUTO=0 CODEX_HOMEcan be relative; wrappers normalize it against current working directory at runtime.
Interactive wrapper route defaults:
- Direct
codex/claude/gemini/opencodestartup now injects an auto-route prompt (single/subagent/team) by default. - Route execution defaults to live for team/subagent command templates.
opencodeinteractive flow falls back to a supported subagent runtime (codex-cliby default).- Override subagent runtime for routed commands with
CTXDB_ROUTE_SUBAGENT_CLIENT=<codex-cli|claude-code|gemini-cli>.
Bootstrap note:
- On first run in a workspace,
ctx-agentmay auto-createtasks/pending/task_<timestamp>_bootstrap_guidelines/*andtasks/.current-taskif both are empty.
Example:
scripts/ctx-agent.sh \
--agent codex-cli \
--project rex-cli \
--session codex-cli-20260303T010101-abcd1234 \
--status done \
--prompt "所有改动完成,给最终总结"
Verification
- Context packet output:
memory/context-db/exports/<session_id>-context.md - Session files:
memory/context-db/sessions/<session_id>/
New ContextDB Retrieval Commands
Use these for index-first retrieval before full packet expansion:
cd mcp-server
npm run contextdb -- search --query "auth race" --project rex-cli --kinds response --refs auth.ts
npm run contextdb -- timeline --session <session_id> --limit 30
npm run contextdb -- event:get --id <session_id>#<seq>
npm run contextdb -- index:rebuild
Optional semantic rerank:
export CONTEXTDB_SEMANTIC=1
export CONTEXTDB_SEMANTIC_PROVIDER=token
npm run contextdb -- search --query "issue auth" --project rex-cli --semantic
Recovery:
- If retrieval returns empty unexpectedly, run
index:rebuildonce. - Source-of-truth remains
memory/context-db/sessions/*; sidecar is rebuildable cache.
Packet Budget and Filters
Use token-aware packet export to control cost:
cd mcp-server
npm run contextdb -- context:pack \
--session <session_id> \
--limit 60 \
--token-budget 1200 \
--token-strategy balanced \
--kinds prompt,response,error \
--refs core.ts,cli.ts
Defaults:
- Event dedupe in packet view is enabled.
--token-strategysupportslegacy|balanced|aggressive(recommended:balanced).- You can disable with
--no-dedupewhen needed for debugging. - For orchestrate/subagent runtime, you can set
AIOS_SUBAGENT_CONTEXT_TOKEN_STRATEGY=balanced.
More from rexleimo/rex-cli
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, update or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
3seed2-manga-drama
当用户要把单图或创意脚本做成AI漫剧短视频时使用。提供Seed2.0风格的四阶段流程:分镜脚本、主角设定、分镜生成、视频验收,并输出可直接投喂生成模型的结构化提示词。
3debug
Evidence-first runtime debugging for application bugs, regressions, flaky behavior, and unclear failures. Use when an agent is asked to debug an issue and should avoid speculative fixes by forming hypotheses, attaching to or starting a logging session, instrumenting code, collecting runtime logs, analyzing the recorded log file, applying only proven fixes, and verifying the result before removing instrumentation, especially for browser or frontend issues where logs should go directly to the active collector endpoint instead of app-local proxy APIs.
2find-skills
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
2xhs-ops-methods
当用户要学习或执行小红书运营方法时使用。提供可复用的“定方向-定人设-写排发互-复盘增长”流程,支持多账号协作,并强调人工审核与合规发布。
2frontend-design
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.
2