# Give coding agents a memory

> Agents lose track of the plan when a session ends or a context window compacts. Kanbus keeps the plan in the repository, where the next session finds it.

Canonical: https://kanb.us/use-cases/coding-agents.html

## The problem

A coding agent works well inside one session and forgets everything between them. Long-running work spreads across chats, branches and notes that nobody can see at once, and after a context compaction the agent no longer knows which task it was on.

## How Kanbus helps

The agent keeps its plan as issues in the repository it is working in. It creates an epic for the goal, tasks for the steps, and moves each one as it goes, leaving comments about what it tried. A person sees the same board in the console and can steer by editing priorities or adding tasks.

```bash
kbs create "Migrate billing to the new API" --type epic
kbs create "Replace the invoice client" --type task --parent kanbus-4c1d2e
kbs update kanbus-9a7b31 --status in_progress --assignee codex
kbs comment kanbus-9a7b31 "Old client removed; two tests still use the fixture"
```

When a context compacts, a hook runs `kbs now`, which prints the work in progress as a short tree, and the agent continues from it instead of starting over.

```bash
kbs now --json --list
```

## What you set up

- [Local files](/ways-to-run/local-files.html): install the CLI and run `kbs init` in the repository.
- `kbs setup agents` writes the Kanbus instructions into `AGENTS.md`, so any agent that reads it knows the commands.
- Set `KANBUS_AGENT_PLATFORM`, `KANBUS_AGENT_MODEL` and `KANBUS_AGENT_NAME` so every issue and comment records which agent wrote it.

[Read about agent provenance](/features/agent-provenance.html) [Read the compaction guide](https://github.com/AnthusAI/Kanbus/blob/main/docs/AGENT_COMPACTION_RIGHT_NOW.md)
