A tiny, local-first CLI that finds the files your AI coding agent actually needs — and packs them into a focused context.
| 1 | # Using agent-context with Claude Code |
| 2 | |
| 3 | ## Install |
| 4 | |
| 5 | ```bash |
| 6 | pip install -e . |
| 7 | # or from PyPI once published: |
| 8 | # pip install agent-context |
| 9 | ``` |
| 10 | |
| 11 | ## One-shot context pack |
| 12 | |
| 13 | From your project root: |
| 14 | |
| 15 | ```bash |
| 16 | agent-context pack "implement OAuth callback" --tokens 12000 |
| 17 | ``` |
| 18 | |
| 19 | This writes `.agent-context/context.md`. |
| 20 | |
| 21 | Then in Claude Code, point the agent at that file — for example: |
| 22 | |
| 23 | ```text |
| 24 | Read .agent-context/context.md and implement the OAuth callback described in the Task section. |
| 25 | Stay within the listed files unless you discover a clear gap. |
| 26 | ``` |
| 27 | |
| 28 | Or paste / attach the markdown directly into the session. |
| 29 | |
| 30 | ## Inspect ranking first |
| 31 | |
| 32 | ```bash |
| 33 | agent-context pack "implement OAuth callback" --verbose |
| 34 | agent-context analyze |
| 35 | agent-context explain |
| 36 | ``` |
| 37 | |
| 38 | ## Optional MCP server |
| 39 | |
| 40 | Expose read-only tools to Claude Code over stdio: |
| 41 | |
| 42 | ```bash |
| 43 | claude mcp add agent-context -- agent-context mcp |
| 44 | ``` |
| 45 | |
| 46 | Tools: |
| 47 | |
| 48 | | Tool | Purpose | |
| 49 | |------|---------| |
| 50 | | `analyze_repository` | File counts, token estimates, sensitive path *names* | |
| 51 | | `find_relevant_files` | Ranked paths + scores for a task | |
| 52 | | `build_context` | Packed markdown (secrets redacted) | |
| 53 | | `repository_map` | Heuristic stack / layout summary | |
| 54 | |
| 55 | The MCP server never executes project commands and never modifies source files. |
| 56 | |
| 57 | ## Safety reminder |
| 58 | |
| 59 | `agent-context` itself stays local. Once Claude Code (or any cloud agent) receives the packed context, that agent's normal data-handling rules apply — review `.agent-context/context.md` before sharing sensitive repos. |