# Claude Code



The Acontext plugin for Claude Code gives your agent cross-session skill memory. It captures conversations, extracts tasks, distills reusable Markdown skills, and syncs them to Claude Code's skill directory for automatic loading.

## Quick Start [#quick-start]

<Steps>
  <Step title="Add the marketplace and install the plugin">
    Inside Claude Code, run:

    ```
    /plugin marketplace add memodb-io/Acontext
    /plugin install acontext
    ```
  </Step>

  <Step title="Set your environment variables">
    Get an API key from [dash.acontext.io](https://dash.acontext.io/) and export it in your shell profile (`~/.bashrc` or `~/.zshrc`):

    ```bash
    export ACONTEXT_API_KEY="<your-api-key>"
    export ACONTEXT_USER_IDENTIFIER="<your-identifier>"
    ```
  </Step>

  <Step title="Restart Claude Code">
    The plugin loads automatically. Every conversation is captured, tasks are extracted, and skills are distilled and synced to `~/.claude/skills/`.
  </Step>
</Steps>

## How It Works [#how-it-works]

```
Session 1: User talks to agent
  └→ Messages stored to Acontext session (incremental capture)
  └→ CORE extracts structured tasks
  └→ Learning Space distills skills as Markdown

Session 2: User returns
  └→ Skills synced to ~/.claude/skills/ (native loading)
  └→ Claude Code auto-loads skill files from its skill directory
  └→ New messages captured (incremental capture)
  └→ Skills updated (auto-learn)
```

The plugin hooks into Claude Code's lifecycle via MCP:

* **On session start** — Syncs learned skills to `~/.claude/skills/` so Claude Code loads them natively
* **On session end** — Stores new conversation messages, triggers task extraction and skill distillation
* **On demand** — Exposes MCP tools the agent can call mid-session (search skills, trigger learning, etc.)

<Note>
  Skills are synced as Markdown files that Claude Code loads natively. You can inspect, modify, and share these files directly in `~/.claude/skills/`.
</Note>

## Configuration [#configuration]

All settings are via environment variables:

| Env Var                        | Default                           | Description                                |
| ------------------------------ | --------------------------------- | ------------------------------------------ |
| `ACONTEXT_API_KEY`             | —                                 | **Required.** Acontext API key             |
| `ACONTEXT_BASE_URL`            | `https://api.acontext.app/api/v1` | API base URL                               |
| `ACONTEXT_USER_IDENTIFIER`     | `"claude_code"`                   | User identifier for session scoping        |
| `ACONTEXT_LEARNING_SPACE_ID`   | auto-created                      | Explicit Learning Space ID                 |
| `ACONTEXT_SKILLS_DIR`          | `~/.claude/skills`                | Directory where skills are synced          |
| `ACONTEXT_AUTO_CAPTURE`        | `true`                            | Store messages after each agent turn       |
| `ACONTEXT_AUTO_LEARN`          | `true`                            | Trigger skill distillation after sessions  |
| `ACONTEXT_MIN_TURNS_FOR_LEARN` | `4`                               | Minimum turns before triggering auto-learn |

<Tip>
  For self-hosted Acontext, set `ACONTEXT_BASE_URL` to your local API endpoint (e.g. `http://localhost:8029/api/v1`).
</Tip>

## MCP Tools [#mcp-tools]

The plugin registers these tools that your agent can call during conversations:

| Tool                       | Description                                              |
| -------------------------- | -------------------------------------------------------- |
| `acontext_search_skills`   | Search through skill files by keyword                    |
| `acontext_get_skill`       | Read the content of a specific skill file                |
| `acontext_session_history` | Get task summaries from recent past sessions             |
| `acontext_stats`           | Show memory statistics (sessions, skills, configuration) |
| `acontext_learn_now`       | Trigger skill learning from the current session          |

## Troubleshooting [#troubleshooting]

### Plugin not loading [#plugin-not-loading]

* Ensure `ACONTEXT_API_KEY` is exported in your shell profile
* Verify the plugin is installed: `/plugin list`
* Check Claude Code logs for `[info] acontext:` or `[warn] acontext:` messages

### No skills appearing [#no-skills-appearing]

* Skills appear in `~/.claude/skills/` after the first session ends
* Check that `ACONTEXT_AUTO_LEARN` is not set to `false`
* Ensure at least `ACONTEXT_MIN_TURNS_FOR_LEARN` turns have occurred

### API returns 401 [#api-returns-401]

* Verify your API key with `acontext whoami`
* Re-login with `acontext login`

## Next Steps [#next-steps]

<CardGroup cols="2">
  <Card title="Skill Memory" icon="brain" href="/learn/quick">
    How Learning Spaces distill skills from sessions
  </Card>

  <Card title="Session Storage" icon="database" href="/store/overview">
    Session persistence and message storage
  </Card>

  <Card title="Task Tracking" icon="radar" href="/observe/whatis">
    Automatic task extraction from conversations
  </Card>

  <Card title="Dashboard" icon="chart-simple" href="/observe/dashboard">
    View all agent interactions and skills
  </Card>
</CardGroup>
