agent-afk 1.15.0 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  - 🔌 **Plugin skill-router** — skills under `~/.afk/plugins/*/skills/` auto-exposed as slash commands
12
12
  - 🏠 **AFK-scoped config** — `~/.afk/` independent of `~/.claude/`, with `afk plugin install/update/list/remove`
13
13
  - 💬 **Three surfaces** — interactive REPL, daemon, Telegram bot sharing one session manager
14
- - 📊 **Routing telemetry** — every subagent dispatch appended to `~/.claude/agent-framework/routing-decisions.jsonl`
14
+ - 📊 **Routing telemetry** — every subagent dispatch appended to `~/.afk/agent-framework/routing-decisions.jsonl`
15
15
  - 🤖 **Multiple Claude models** — Opus, Sonnet, Haiku
16
16
  - 🔓 **Bypass permissions mode** — no prompts, fully automated tool execution
17
17
  - 🛡️ **Type-safe** — TypeScript strict mode
@@ -200,7 +200,7 @@ pnpm telegram:restart
200
200
 
201
201
  ## Orchestration Skills
202
202
 
203
- agent-afk ships seven built-in subagent orchestrators plus `devils-advocate` (in development). These are **skill-router-dispatched**: typing `/mint add dark mode` in the REPL parses the slash form, resolves it to a skill handler under `src/skills/<name>/`, and dispatches a fresh subagent via `SubagentManager.forkSubagent()`. Every dispatch is logged to `~/.claude/agent-framework/routing-decisions.jsonl`.
203
+ agent-afk ships seven built-in subagent orchestrators plus `devils-advocate` (in development). These are **skill-router-dispatched**: typing `/mint add dark mode` in the REPL parses the slash form, resolves it to a skill handler under `src/skills/<name>/`, and dispatches a fresh subagent via `SubagentManager.forkSubagent()`. Every dispatch is logged to `~/.afk/agent-framework/routing-decisions.jsonl`.
204
204
 
205
205
  | Skill | Purpose |
206
206
  |---|---|
@@ -304,6 +304,24 @@ AFK_PROMPT_CACHE_TTL=1h # 5m | 1h (default 1h)
304
304
  NO_COLOR=
305
305
  ```
306
306
 
307
+ ### System Prompt Auto-Discovery
308
+
309
+ agent-afk resolves the session system prompt through a 4-tier precedence chain (highest tier wins):
310
+
311
+ | Tier | Source | Notes |
312
+ |------|--------|-------|
313
+ | 1 | `AFK_SYSTEM_PROMPT` env var | Highest priority — overrides everything |
314
+ | 2 | `afk.config.json` (`systemPrompt` field) | Searched in: `<cwd>/afk.config.json` → `~/.afk/config/afk.config.json` → legacy `~/.afk.config.json` |
315
+ | 3 | `AFK.md` file | Searched in: `<cwd>/AFK.md` → `$AFK_HOME/AFK.md` (default `~/.afk/AFK.md`) |
316
+ | 4 | None | `systemPrompt` is `undefined`; SDK uses its default behavior |
317
+
318
+ **AFK.md format:** Plain Markdown, no frontmatter. The entire file content (trimmed) becomes the system prompt. Empty or whitespace-only files are treated as absent (tier 4 applies instead).
319
+
320
+ **Provenance tracking:** When using `--dump-prompt`, the `systemPromptSource` field in the dump shows which tier won:
321
+ - `"env:AFK_SYSTEM_PROMPT"` — tier 1
322
+ - `"file:/abs/path/afk.config.json"` — tier 2
323
+ - `"afk-md:/abs/path/AFK.md"` — tier 3
324
+
307
325
  ### Prompt Caching (anthropic-direct provider)
308
326
 
309
327
  The `anthropic-direct` provider stamps two `cache_control` breakpoints per request — one at the end of `system` (which implicitly caches `tools + system` together) and one at the end of the last `messages[]` entry. The end-of-messages marker floats forward each turn; cache lookup walks back over prefix-hash matches up to a 20-block window, so the moving marker still hits prior cache writes within a tool-use loop and across consecutive turns.