agent-afk 1.20.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 +18 -0
- package/dist/cli.mjs +213 -204
- package/dist/index.mjs +76 -73
- package/dist/telegram.mjs +90 -87
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -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.
|