Agentic Context Engine is an open-source engine that gives AI agents a persistent learning loop, helping them remember successful strategies and learn from failures across sessions. It is used to improve production agents, and also powers Kayba’s hosted service. Catalogue add-ons support workflows for operating and configuring the engine.
Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add commands/kayba-ai/agentic-context-engine/checkout-branchgit clone --depth 1 https://github.com/kayba-ai/agentic-context-engineWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/kayba-ai/agentic-context-engine/checkout-branch)<a href="https://agentmods.dev/commands/kayba-ai/agentic-context-engine/checkout-branch"><img src="https://agentmods.dev/badge/commands/kayba-ai/agentic-context-engine/checkout-branch.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.00676 |
| Opus 5 | $0.00000 | $0.00338 |
| Sonnet 5 | $0.00000 | $0.00135 |
| Haiku 4.5 | $0.00000 | $0.00068 |
Grade A, and why
checkout-branch scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
Switch to an existing branch by checking out its worktree, or creating one if needed.
Arguments: $ARGUMENTS should be the branch name (full or partial match)
Examples:
/checkout-branch feature/john/add-caching→ switch to branch (create worktree if needed)/checkout-branch add-caching→ partial match, resolve to full branch name/checkout-branch fix→ if multiple matches, list them and ask to be specific
Steps:
- Parse branch name from arguments
- Fetch latest from remote:
git fetch --prune - Get all branches (local + remote):
git branch -a --format='%(refname:short)' - Resolve branch name:
- Exact match: use directly
- Partial match: find branches containing the search term
- No match: show error with similar branches (if any)
- Get worktree list:
git worktree list --porcelain - Check if resolved branch has an existing worktree
- If worktree exists:
- Show path and suggest
cd <path>
- Show path and suggest
- If no worktree:
- Construct worktree path:
../<sanitized-branch-name>(replace all/with-) - If remote-only branch (starts with
origin/):git worktree add <path> -b <local-name> <remote-name> - If local branch:
git worktree add <path> <branch> - Symlink
.env: if<main-worktree>/.envexists (get main worktree fromgit worktree list --porcelain | head -1), runln -s <main-worktree>/.env <new-worktree>/.env - Show path and suggest
cd <path>
- Construct worktree path:
On success (worktree exists), output:
✓ Branch already has worktree at: <worktree-path>
To switch to the worktree:
cd <worktree-path>
On success (worktree created from local branch), output:
✓ Created worktree: <worktree-path>
✓ Linked .env → <main-worktree>/.env
To switch to the worktree:
cd <worktree-path>
On success (worktree created from remote branch), output:
✓ Created local branch: <branch-name> (tracking origin/<branch-name>)
✓ Created worktree: <worktree-path>
✓ Linked .env → <main-worktree>/.env
To switch to the worktree:
cd <worktree-path>
Error handling:
- Branch not found: "Branch not found: . Did you mean one of these?" (list similar branches)
- Multiple partial matches: "Multiple branches match '':" (list matches, ask to be more specific)
- No branches at all: "No branches found matching ''"
Branch resolution priority:
- Exact match on full branch name
- Exact match on last segment (e.g., "add-caching" matches "feature/john/add-caching")
- Partial substring match anywhere in branch name
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 5d ago First seen · 65 lines · 0 tokens per session scan A 524088f752db
checkout-branch is a command published in the GitHub repository kayba-ai/agentic-context-engine (2,564 stars, last pushed 7d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 676 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other commands, from other repositories
dream-apply
Walk a dream proposal artifact, review each item, apply accepted ones, commit.
end
End a session — log what happened and propose durable memory updates.
dream
Run a curator pass over the memory dir. Produces a proposal artifact for /dream-apply. Default curator: rot.
start
Start a session — load context + memory and brief yourself on current state.
update
Mid-session checkpoint — save progress without ending the session.
applychanges
Apply the AI's code changes to your files.