Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions claude/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,28 +266,6 @@
]
}
],
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "sh \"${CLAUDE_PLUGIN_ROOT}/hooks/akm-hook.sh\" capture-memory session-end",
"timeout": 30
}
]
}
],
"SubagentStop": [
{
"hooks": [
{
"type": "command",
"command": "sh \"${CLAUDE_PLUGIN_ROOT}/hooks/akm-hook.sh\" capture-memory subagent-end",
"timeout": 30
}
]
}
],
"SubagentStart": [
{
"hooks": [
Expand Down Expand Up @@ -321,17 +299,6 @@
]
}
],
"PreCompact": [
{
"hooks": [
{
"type": "command",
"command": "sh \"${CLAUDE_PLUGIN_ROOT}/hooks/akm-hook.sh\" capture-memory pre-compact",
"timeout": 30
}
]
}
],
"PostCompact": [
{
"hooks": [
Expand Down
13 changes: 5 additions & 8 deletions claude/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ claude plugin install akm@akm-plugins
## What's included

- **AKM Skill** — Claude automatically uses the `akm` CLI when you ask about stash assets
- **Agentic hooks** — lifecycle hooks that install `akm`, set `defaults.agent` to `claude` (and add a matching `profiles.agent.claude` entry) in `~/.config/akm/config.json` when no agent default is configured, auto-curate stash matches into every user prompt, auto-record feedback when assets are used (skipping proposed-quality drafts plus `lesson:*` and `secret:*` refs), surface pending-proposal counts in the SessionStart header, and harvest session memories at stop/compact time
- **Agentic hooks** — lifecycle hooks that install `akm`, set `defaults.agent` to `claude` (and add a matching `profiles.agent.claude` entry) in `~/.config/akm/config.json` when no agent default is configured, auto-curate stash matches into every user prompt, auto-record feedback when assets are used (skipping proposed-quality drafts plus `lesson:*` and `secret:*` refs), surface pending-proposal counts in the SessionStart header, mine memory candidates for `/akm-memory-promote`, and refresh the stash index + run extraction on session end
- **Slash commands** — 22 first-class verbs (`/akm-search`, `/akm-show`, `/akm-agent`, `/akm-cmd`, `/akm-curate`, `/akm-remember`, `/akm-feedback`, `/akm-evolve`, `/akm-wiki`, `/akm-workflow`, `/akm-env`, `/akm-secret`, `/akm-proposal`, `/akm-review-proposals`, `/akm-improve`, `/akm-propose`, `/akm-setup`, `/akm-memory-audit`, `/akm-memory-candidates`, `/akm-memory-promote`, `/akm-memory-reject`, `/akm-help`) for explicit control of the compound-engineering loop
- **`akm-curator` agent** — a self-evolution subagent that reviews session logs and proposes stash improvements

Expand Down Expand Up @@ -146,18 +146,16 @@ or the CLI call fails, the hook exits silently without affecting the session.
| --- | --- |
| **SessionStart** | Verifies `akm` on PATH satisfies the required `^0.8.0` range (override via `AKM_PACKAGE_REF`). When `akm` is missing or out of range, the hook does **not** install anything — it writes a clear stderr banner pointing the user at the `/akm-setup` slash command (the explicit-consent install path) and emits a degraded SessionStart context telling the agent `akm` tooling is unavailable for this session. When `akm` is healthy, the hook sets `defaults.agent` to `claude` (and ensures `profiles.agent.claude` exists) in `~/.config/akm/config.json` when no agent default is configured (legacy `agent.default` is auto-migrated on load), surfaces the configured agent CLI plus any pending-proposal count in the injected header, warms the stash index in the background, injects `akm hints`, and runs a scoped `akm curate --run <session_id>` so Claude gets relevant stash context before the first user message. Human users should run `akm setup` manually when interactive setup is needed. |
| **UserPromptSubmit** | Runs `akm curate "<prompt>" --run <session_id>` and injects the top matches as `additionalContext` so Claude sees relevant stash assets before answering. Short prompts (under `AKM_CURATE_MIN_CHARS` chars, default 16) are skipped. Also records `remember`/`memory` intents to the session buffer. |
| **UserPromptExpansion** | Logs expanded `/akm-*` slash-command usage, injects a short reminder when a mutating memory/proposal command is expanded without explicit confirmation language, and takes a fresh proposal-prep checkpoint before `/akm-improve`, `/akm-evolve`, or `/akm-propose` when the local session buffer has unflushed evidence. |
| **UserPromptExpansion** | Logs expanded `/akm-*` slash-command usage and injects a short reminder when a mutating memory/proposal command is expanded without explicit confirmation language. |
| **PreToolUse** (Agent) | Resolves invalid Claude Code subagent model aliases (e.g. `balanced`, `gpt-4o`) to the four valid aliases (`sonnet`, `opus`, `haiku`, `inherit`) so dispatch is never rejected upstream. |
| **PreToolUse** (Read / Write / Edit / Glob / Grep) | Observes asset refs in tool input for memory-event capture. Never blocks. |
| **PostToolUse** (Bash, success) | Logs `akm` Bash invocations, harvests any `type:name` asset refs (including `lesson:*`) from command+output, and calls `akm feedback <ref> --positive` so successful usage boosts ranking. Skips `memory:*`, `env:*`, `secret:*`, `lesson:*`, and any ref the indexer reports as `quality:"proposed"`. |
| **PostToolUseFailure** (Bash) | Same as above but records `--negative` feedback with the failure note. |
| **PostToolBatch** | Records grouped tool-batch observations as structured events and appends a short batch summary to the local session buffer for later checkpoint extraction. |
| **PostToolBatch** | Records grouped tool-batch observations as structured events and appends a short batch summary to the local session buffer for later candidate extraction. |
| **SubagentStart** | Injects concise AKM subagent context, including the detected role, task preview, and any active workflow summary. |
| **Stop** / **SubagentStop** | Flushes the per-session buffer into a `memory:claude-session-YYYYMMDD-<sid>` memory so every meaningful session contributes durable context for future searches. Session memories now include explicit paths to the local state, buffer, event/candidate logs, and optional harness log plus higher-value evidence aggregates so follow-on improve agents can inspect the full artifacts directly. The hook also follows that flush with `akm index` so upstream inference/graph passes run immediately. Set `AKM_INDEX_ON_SESSION_END=0` to opt out (e.g. low-power dev machines, CI runners). |
| **TaskCreated** / **TaskCompleted** | Records task lifecycle events, appends task summaries to the local session buffer, and lets completed-task summaries feed candidate extraction through the normal checkpoint/session flush path. |
| **PreCompact** | Same memory capture before Claude Code compacts the transcript, with the same default-on post-flush `akm index` run (set `AKM_INDEX_ON_SESSION_END=0` to skip). |
| **TaskCreated** / **TaskCompleted** | Records task lifecycle events, appends task summaries to the local session buffer, and lets completed-task summaries feed candidate extraction (surfaces suggestions for `/akm-memory-promote`) using the buffer as source-path evidence. |
| **PostCompact** | Records the compacted summary as a structured event and buffers a short post-compaction note for later recall. |
| **SessionEnd** | Reuses the session-final memory capture path so Claude can flush the final checkpoint even when `Stop` is not the last lifecycle event observed. |
| **SessionEnd** | Runs `akm index` so upstream inference/graph passes pick up the session's changes (set `AKM_INDEX_ON_SESSION_END=0` to skip), and separately fires event-driven `akm extract` for the just-ended session so durable insights reach the proposal queue without waiting for the periodic `akm improve` extract pass. |

### Locking down destructive commands

Expand Down Expand Up @@ -237,7 +235,6 @@ Notes:
| `AKM_PACKAGE_REF` | `akm-cli@^0.8.0` | Override the npm/bun package spec displayed in the SessionStart consent banner and used by `/akm-setup` (for example, to pin a compatible AKM build in CI). The plugin never installs this automatically — it is only quoted in the banner. |
| `AKM_LOCAL_BUILD_CLI` | _(unset)_ | Optional absolute path to a locally built AKM CLI entrypoint such as `/abs/path/to/akm/dist/cli.js`. When set, the Claude hook runs that build through Bun before checking `akm` on PATH. Useful when developing `akm` and `akm-plugin` side by side. |
| `AKM_AUTO_FEEDBACK` | `1` | Set to `0` to disable automatic `akm feedback` on tool success/failure. |
| `AKM_AUTO_MEMORY` | `1` | Set to `0` to disable automatic session-summary memories. |
| `AKM_INDEX_ON_SESSION_END` | `1` | Set to `0` to skip the post-session `akm index` run (e.g. low-power dev machines or CI runners). |
| `AKM_CURATE_LIMIT` | `5` | Max curated results injected into context per prompt. |
| `AKM_CURATE_MIN_CHARS` | `16` | Minimum prompt length before curation runs. |
Expand Down
Loading
Loading