Skip to content

docs(afk): refresh README against agent-afk 5.286.1 source - #35

Merged
0x7067 merged 3 commits into
0x7067:mainfrom
griffinwork40:afk-readme-refresh
Oct 5, 2026
Merged

0x7067 merged 3 commits into
0x7067:mainfrom
griffinwork40:afk-readme-refresh

Conversation

@griffinwork40

@griffinwork40 griffinwork40 commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Refreshes adapters/afk/README.md against agent-afk 5.286.1 source. All claims verified with git log -S, git tag --contains, and direct source reads. The patch_apply Known-gaps bullet and the rules.ts hook-table row are untouched (owned by sibling branches).

Per-claim table

# Claim Old text New text agent-afk evidence Release
1 PreToolUse block path: blocking additionalContext "AFK drops everything except a block from a PreToolUse hook" (implied no additionalContext on block) Blocking additionalContext is appended to the error tool result the model sees; non-blocking is still dropped (#2778) dispatcher.pre-dispatch-gates.ts:548 (err.injectContext appended to blockResult.content) v5.121.0 (commit b423000ac)
2 transcript_path in hook stdin "No transcript access: Hooks receive only the current event" transcript_path sent from v5.276.14; null on daemon/chat/web and pre-first-turn REPL; adapter does not use it yet command-executor.ts:101-104,156-162 v5.276.14 (commit 39e88574a)
3 PreCompact hook "No compaction hook: AFK CLI hooks do not expose the transcript access needed for Jev-scored compaction" PreCompact event fires before manual and auto-compact; can block; cannot select which blocks to keep; adapter does not register one config-loader.ts:286; query-turn-driver.auto-compact.ts:53-61; cli/slash/commands/core.ts:85-91 v5.10.0 (commits aa25b101, eba1ef9c)
4 Plugin PreToolUse fires in subagent forks; SessionStart injectContext does not Not documented PreToolUse hooks fire inside forks (fork-child-config.ts:314, hookRegistry inherited); SessionStart injectContext gated on parentSessionId === undefined fork-child-config.ts:314; provider-lifecycle.ts:171 v5.121.0
5 pluginHookEnv for API key forwarding "AFK forwards no secrets to hooks, so the hooks read their key from afk.env themselves (#2459)" pluginHookEnv documented as supported route (key = claude-jev-afk); process.env wins over afk.env; afk.env read is documented as fallback command-executor.ts:347-383 (applyPluginHookEnv); config-loader.ts:241-263 v5.276.21 (commit 4c3db5ee4)
6 UserPromptSubmit/Stop REPL-only; per-hook disable gap "#2371 link only; no issue link for REPL-only" Added #2817 link to REPL-only gap; added #2816 (cannot disable single hook without editing hooks.json) to subagent gap loop-iteration.ts:559 (UserPromptSubmit), :795 (Stop) Dispatch sites confirmed at current HEAD
7 CLAUDE_CONFIG_DIR / CLAUDE_PLUGIN_OPTION_* "AFK passes neither CLAUDE_CONFIG_DIR nor CLAUDE_PLUGIN_OPTION_* (5.265.3, #2373)" Still true on 5.286.1; #2373 open, implementation in unmerged agent-afk PR #2732 command-executor.ts env allowlist (no CLAUDE_CONFIG_DIR); 4819e9eb1 is only on PR #2732 branches unreleased

Additional fixes beyond the list

  • "How blocking works" paragraph: rewrote the sentence "AFK drops everything except a block from a PreToolUse hook" to distinguish blocking vs non-blocking additionalContext, consistent with item 1.
  • Runtime requirements: updated key-storage line from "in AFK's afk.env" to "via pluginHookEnv (recommended) or afk.env (fallback)" to match Setup section.
  • Setup section: added pluginHookEnv JSON example with correct key claude-jev-afk (verified from .claude-plugin/plugin.json), precedence note, and security constraint (user-global only). Restructured existing afk.env text as "Fallback".

CHANGELOG

[Unreleased] bullet added summarizing all seven items.

Not done / open questions

None. The patch_apply bullet and rules.ts hook-table row were not touched per instructions (owned by sibling branches).


Summary by cubic

Refreshes adapters/afk/README.md and the CHANGELOG against agent-afk 5.286.1 source, correcting seven out-of-date claims verified against tags and source reads. The patch_apply gap bullet and rules.ts table row are intentionally untouched.

Highlights:

  • Blocking additionalContext on PreToolUse now reaches the model; non-blocking is still dropped (#2778).
  • Documents transcript_path in hook stdin, the PreCompact hook event, and PreToolUse firing in subagent forks (where SessionStart injectContext does not).
  • Documents pluginHookEnv as the supported route for TYPESAFE_API_KEY / OPENROUTER_API_KEY, with direct afk.env read as fallback.
  • Keeps the CLAUDE_CONFIG_DIR / CLAUDE_PLUGIN_OPTION_* gap as still unfixed on 5.286.1: #2373 is open and the implementation in PR #2732 is unmerged; also adds #2816/#2817 links.
  • Rewrites the "How blocking works" paragraph, adds a pluginHookEnv setup example, and updates Runtime requirements to match.

Written for commit 65a624d. Summary will update on new commits.

Review in cubic

Update adapters/afk/README.md for seven verified changes in agent-afk:

1. Blocking additionalContext on PreToolUse now reaches the model
   (dispatcher.pre-dispatch-gates.ts:548; v5.121.0). Non-blocking
   additionalContext is still dropped (#2778).

2. transcript_path is sent in hook stdin payloads from v5.276.14
   (command-executor.ts:101-104, 156-162). Null on daemon/chat/web/
   pre-first-turn REPL.

3. PreCompact hook event fires before manual and auto-compact (config-
   loader.ts:286; v5.10.0). Can block compaction; cannot select blocks.

4. PreToolUse hooks fire inside subagent forks (fork-child-config.ts:314;
   v5.121.0). SessionStart injectContext is gated on parentSessionId===
   undefined so it does not reach forks (provider-lifecycle.ts:171).

5. pluginHookEnv (command-executor.ts:347-383; v5.276.21, #2700) is the
   supported route for TYPESAFE_API_KEY / OPENROUTER_API_KEY. Key matches
   manifest name "claude-jev-afk". process.env wins over afk.env. Direct
   afk.env read is documented as fallback.

6. UserPromptSubmit and Stop dispatch sites confirmed (loop-iteration.ts:
   559, 795). Added #2817 link. Added #2816 (per-hook disable) to subagent
   gap.

7. CLAUDE_PLUGIN_OPTION_* and CLAUDE_CONFIG_DIR now exported by v5.286.1
   (command-executor.ts:492+; #2373 closed). Adapter has no userConfig
   fields so receives no CLAUDE_PLUGIN_OPTION_* today.

Also: updated "How blocking works" to reflect blocking additionalContext
behavior; updated Runtime requirements key-storage line.

CHANGELOG [Unreleased] bullet added.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="adapters/afk/README.md">

<violation number="1" location="adapters/afk/README.md:64">
P2: This sentence is false once `pluginHookEnv` is configured: AFK forwards a key inherited in its `process.env` to the hook. Qualify it to describe only the reduced environment without `pluginHookEnv`.</violation>

<violation number="2" location="adapters/afk/README.md:146">
P3: The bullet is still titled "No transcript access", but its own first sentence now says AFK sends `transcript_path` in hook stdin (agent-afk 5.276.14) and that it is available in the REPL after the first turn — which is exactly where the prompt router and Stop sweep run. Retitle the bullet to reflect the remaining gap (null on daemon/chat/web, unused by the adapter), e.g. "Transcript access is limited".</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread adapters/afk/README.md
`TYPESAFE_API_KEY` is checked first. The SessionStart hook (rule digest) requires no API key.

AFK starts hook commands with a reduced environment: `PATH`, `HOME`, `SHELL`, `LANG`, `TERM`, `TMPDIR`, `USER`, `LOGNAME`, non-secret `AFK_*` variables, and `CLAUDE_PLUGIN_ROOT`. A key exported in your shell does not reach the hooks. Store it in AFK's env file instead, which the hooks read when AFK runs them. `afk config env set` refuses these names (`unknown config key`, agent-afk 5.259.0), so add the line with an editor:
AFK starts hook commands with a reduced environment: `PATH`, `HOME`, `SHELL`, `LANG`, `TERM`, `TMPDIR`, `USER`, `LOGNAME`, non-secret `AFK_*` variables, and `CLAUDE_PLUGIN_ROOT`. A key exported in your shell does not reach the hooks.

@cubic-dev-ai cubic-dev-ai Bot Oct 3, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This sentence is false once pluginHookEnv is configured: AFK forwards a key inherited in its process.env to the hook. Qualify it to describe only the reduced environment without pluginHookEnv.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At adapters/afk/README.md, line 64:

<comment>This sentence is false once `pluginHookEnv` is configured: AFK forwards a key inherited in its `process.env` to the hook. Qualify it to describe only the reduced environment without `pluginHookEnv`.</comment>

<file context>
@@ -61,7 +61,22 @@ export OPENROUTER_API_KEY=sk-or-...
 `TYPESAFE_API_KEY` is checked first. The SessionStart hook (rule digest) requires no API key.
 
-AFK starts hook commands with a reduced environment: `PATH`, `HOME`, `SHELL`, `LANG`, `TERM`, `TMPDIR`, `USER`, `LOGNAME`, non-secret `AFK_*` variables, and `CLAUDE_PLUGIN_ROOT`. A key exported in your shell does not reach the hooks. Store it in AFK's env file instead, which the hooks read when AFK runs them. `afk config env set` refuses these names (`unknown config key`, agent-afk 5.259.0), so add the line with an editor:
+AFK starts hook commands with a reduced environment: `PATH`, `HOME`, `SHELL`, `LANG`, `TERM`, `TMPDIR`, `USER`, `LOGNAME`, non-secret `AFK_*` variables, and `CLAUDE_PLUGIN_ROOT`. A key exported in your shell does not reach the hooks.
+
+**Supported route (agent-afk 5.276.21):** add the key to `pluginHookEnv` in `~/.afk/config/afk.config.json`, keyed by the plugin's manifest name (`claude-jev-afk`):
</file context>
Suggested change
AFK starts hook commands with a reduced environment: `PATH`, `HOME`, `SHELL`, `LANG`, `TERM`, `TMPDIR`, `USER`, `LOGNAME`, non-secret `AFK_*` variables, and `CLAUDE_PLUGIN_ROOT`. A key exported in your shell does not reach the hooks.
AFK starts hook commands with a reduced environment: `PATH`, `HOME`, `SHELL`, `LANG`, `TERM`, `TMPDIR`, `USER`, `LOGNAME`, non-secret `AFK_*` variables, and `CLAUDE_PLUGIN_ROOT`. Without `pluginHookEnv`, a key exported in your shell does not reach the hooks.
Fix with cubic

Comment thread adapters/afk/README.md
- **Named agents are not routed**: a spawn with an `agent_type` takes that agent's model defaults, so the hook skips the tier question and only checks the brief.
- **No transcript access**: Hooks receive only the current event, not the conversation. The prompt router uses the prompt alone (the Python adapter also uses the previous turn).
- **No compaction hook**: AFK CLI hooks do not expose the transcript access needed for Jev-scored compaction.
- **No transcript access**: AFK sends `transcript_path` in hook stdin payloads from agent-afk 5.276.14 ([griffinwork40/agent-afk#2647](https://github.com/griffinwork40/agent-afk/pull/2647)). It is `null` on daemon, `afk chat`, and web surfaces, and in the REPL before the first turn completes. The adapter does not use it yet (the prompt router uses the prompt alone; the Python adapter also uses the previous turn).

@cubic-dev-ai cubic-dev-ai Bot Oct 3, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The bullet is still titled "No transcript access", but its own first sentence now says AFK sends transcript_path in hook stdin (agent-afk 5.276.14) and that it is available in the REPL after the first turn — which is exactly where the prompt router and Stop sweep run. Retitle the bullet to reflect the remaining gap (null on daemon/chat/web, unused by the adapter), e.g. "Transcript access is limited".

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At adapters/afk/README.md, line 146:

<comment>The bullet is still titled "No transcript access", but its own first sentence now says AFK sends `transcript_path` in hook stdin (agent-afk 5.276.14) and that it is available in the REPL after the first turn — which is exactly where the prompt router and Stop sweep run. Retitle the bullet to reflect the remaining gap (null on daemon/chat/web, unused by the adapter), e.g. "Transcript access is limited".</comment>

<file context>
@@ -119,15 +136,16 @@ The `AFK rule checks` section of `stats.py` counts these per phase, lists the ru
 - **Named agents are not routed**: a spawn with an `agent_type` takes that agent's model defaults, so the hook skips the tier question and only checks the brief.
-- **No transcript access**: Hooks receive only the current event, not the conversation. The prompt router uses the prompt alone (the Python adapter also uses the previous turn).
-- **No compaction hook**: AFK CLI hooks do not expose the transcript access needed for Jev-scored compaction.
+- **No transcript access**: AFK sends `transcript_path` in hook stdin payloads from agent-afk 5.276.14 ([griffinwork40/agent-afk#2647](https://github.com/griffinwork40/agent-afk/pull/2647)). It is `null` on daemon, `afk chat`, and web surfaces, and in the REPL before the first turn completes. The adapter does not use it yet (the prompt router uses the prompt alone; the Python adapter also uses the previous turn).
+- **PreCompact hook exists but cannot select what to keep**: A `PreCompact` hook event fires before any compaction (manual `/compact` or auto-compact). It can block compaction entirely (agent-afk 5.10.0 for manual, 5.10.0 for auto). It cannot choose which conversation blocks to keep; that requires transcript-level access the hook does not receive. The adapter does not register a `PreCompact` handler today.
+- **SessionStart injectContext reaches the parent session only**: AFK gates SessionStart `injectContext` delivery on `parentSessionId === undefined` (`provider-lifecycle.ts`), so the rule digest injected by `session-start.ts` does not reach subagent forks. `PreToolUse` hooks (rules) do fire inside forks.
</file context>
Suggested change
- **No transcript access**: AFK sends `transcript_path` in hook stdin payloads from agent-afk 5.276.14 ([griffinwork40/agent-afk#2647](https://github.com/griffinwork40/agent-afk/pull/2647)). It is `null` on daemon, `afk chat`, and web surfaces, and in the REPL before the first turn completes. The adapter does not use it yet (the prompt router uses the prompt alone; the Python adapter also uses the previous turn).
- **Transcript access is limited**: AFK sends `transcript_path` in hook stdin payloads from agent-afk 5.276.14 ([griffinwork40/agent-afk#2647](https://github.com/griffinwork40/agent-afk/pull/2647)). It is `null` on daemon, `afk chat`, and web surfaces, and in the REPL before the first turn completes. The adapter does not use it yet (the prompt router uses the prompt alone; the Python adapter also uses the previous turn).
Fix with cubic

The previous commit said agent-afk 5.286.1 closed #2373. It did not:
#2373 is open and its implementation (agent-afk PR #2732, commit
4819e9eb1) is unmerged and in no release tag. Restore the gap,
cite 5.286.1, and link the pending PR.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="adapters/afk/README.md">

<violation number="1" location="adapters/afk/README.md:139">
P3: The provider is not inherently unpinnable: the adapter honors `CLAUDE_PLUGIN_OPTION_PROVIDER`, and `pluginHookEnv` is documented as forwarding explicitly listed variables. Qualify this as unavailable in AFK’s default environment rather than saying it cannot be pinned.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread adapters/afk/README.md
- **Subagent routing is not delivered**: AFK command hooks read only `continue`, `decision`, `reason`, and `hookSpecificOutput.additionalContext` (agent-afk 5.265.3, [#2371](https://github.com/griffinwork40/agent-afk/issues/2371)), and AFK keeps nothing but a block from a `PreToolUse` hook (agent-afk 5.259.0). The subagent router never blocks, so its tier recommendation and missing-brief note reach neither the agent nor the user, and the hook cannot switch the model. AFK does honor `decision: "block"` with a `reason`, so denying a bad brief is possible, but the adapter does not do it yet.
- **Uncertain rule matches are not delivered**: see [How blocking works](#how-blocking-works).
- **Prompt and turn-end hooks run only in the REPL**: AFK fires `UserPromptSubmit` and `Stop` only in the interactive REPL, so the prompt router and the Stop sweep never run in `afk chat`, Telegram, or daemon sessions.
- **Hook environment**: AFK passes neither `CLAUDE_CONFIG_DIR` nor `CLAUDE_PLUGIN_OPTION_*` to hooks (agent-afk 5.286.1, [#2373](https://github.com/griffinwork40/agent-afk/issues/2373), open; [#2732](https://github.com/griffinwork40/agent-afk/pull/2732) proposes exporting both). Logs go to `~/.claude`, and the provider follows the key's prefix; it cannot be pinned. Use `pluginHookEnv` for the API key (see Setup).

@cubic-dev-ai cubic-dev-ai Bot Oct 3, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The provider is not inherently unpinnable: the adapter honors CLAUDE_PLUGIN_OPTION_PROVIDER, and pluginHookEnv is documented as forwarding explicitly listed variables. Qualify this as unavailable in AFK’s default environment rather than saying it cannot be pinned.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At adapters/afk/README.md, line 139:

<comment>The provider is not inherently unpinnable: the adapter honors `CLAUDE_PLUGIN_OPTION_PROVIDER`, and `pluginHookEnv` is documented as forwarding explicitly listed variables. Qualify this as unavailable in AFK’s default environment rather than saying it cannot be pinned.</comment>

<file context>
@@ -136,7 +136,7 @@ The `AFK rule checks` section of `stats.py` counts these per phase, lists the ru
 ## Known gaps
 
-- **Hook environment**: AFK passes `CLAUDE_CONFIG_DIR` to hooks as of agent-afk 5.286.1 ([griffinwork40/agent-afk#2373](https://github.com/griffinwork40/agent-afk/issues/2373) closed). `CLAUDE_PLUGIN_OPTION_*` is now exported for declared non-sensitive `userConfig` fields (agent-afk 5.286.1). The adapter does not declare `userConfig` fields, so it receives no `CLAUDE_PLUGIN_OPTION_*` today; use `pluginHookEnv` for secrets (see Setup).
+- **Hook environment**: AFK passes neither `CLAUDE_CONFIG_DIR` nor `CLAUDE_PLUGIN_OPTION_*` to hooks (agent-afk 5.286.1, [#2373](https://github.com/griffinwork40/agent-afk/issues/2373), open; [#2732](https://github.com/griffinwork40/agent-afk/pull/2732) proposes exporting both). Logs go to `~/.claude`, and the provider follows the key's prefix; it cannot be pinned. Use `pluginHookEnv` for the API key (see Setup).
 - **Key from `afk.env`**: `pluginHookEnv` (agent-afk 5.276.21) is the supported route to forward `TYPESAFE_API_KEY` and `OPENROUTER_API_KEY` to hook subprocesses. The adapter's direct `afk.env` read is a fallback the hooks still perform.
 - **Subagent routing is not delivered**: The subagent router never blocks, so its tier recommendation and missing-brief note reach neither the agent nor the user. `PreToolUse` hooks fire inside subagent child sessions (agent-afk 5.121.0, `fork-child-config.ts`), so the rule hook already judges edits made by subagents. A single plugin hook cannot be disabled without editing `hooks.json` ([griffinwork40/agent-afk#2816](https://github.com/griffinwork40/agent-afk/issues/2816)).
</file context>
Suggested change
- **Hook environment**: AFK passes neither `CLAUDE_CONFIG_DIR` nor `CLAUDE_PLUGIN_OPTION_*` to hooks (agent-afk 5.286.1, [#2373](https://github.com/griffinwork40/agent-afk/issues/2373), open; [#2732](https://github.com/griffinwork40/agent-afk/pull/2732) proposes exporting both). Logs go to `~/.claude`, and the provider follows the key's prefix; it cannot be pinned. Use `pluginHookEnv` for the API key (see Setup).
- **Hook environment**: AFK does not automatically pass `CLAUDE_CONFIG_DIR` or `CLAUDE_PLUGIN_OPTION_*` to hooks (agent-afk 5.286.1, [#2373](https://github.com/griffinwork40/agent-afk/issues/2373), open; [#2732](https://github.com/griffinwork40/agent-afk/pull/2732) proposes exporting both). Logs go to `~/.claude`; the default provider follows the key's prefix, while the adapter still honors `CLAUDE_PLUGIN_OPTION_PROVIDER` when it is explicitly supplied. Use `pluginHookEnv` for the API key (see Setup).
Fix with cubic

Keep both [Unreleased] CHANGELOG bullets from 0x7067#34 and 0x7067#35.
@0x7067
0x7067 merged commit 4daa6f2 into 0x7067:main Oct 5, 2026
2 checks passed
0x7067 added a commit to griffinwork40/claude-jev that referenced this pull request Oct 5, 2026
Keep 0x7067#35 Known-gaps wording; drop only the patch_apply gap bullet (0x7067#36 fixes it). CHANGELOG kept both Unreleased entries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants