docs(agents): document the activity-marker contract for agent CLIs without a plugin - #3848
Merged
Merged
Conversation
…thout a plugin Any CLI with session-lifecycle hooks can drive the 🤖/💬 markers in `wt list` — the plugins only call `wt config state marker` on their host's events. Document that contract so it is a supported integration path rather than something reverse-engineered from the manual-markers section. Refs #3847
worktrunk-bot
commented
Aug 18, 2026
worktrunk-bot
left a comment
Collaborator
Author
There was a problem hiding this comment.
Docs-only, and the contract it states matches the shipped plugins (plugins/worktrunk/hooks/hooks.json and dev/opencode-plugin.ts both do exactly set-🤖 / set-💬 / clear, each with || true). Two claims in the "three things to get right" list don't hold up against the code, though — details inline.
Both suggestions target docs/content/claude-code.md, which is the primary for this page; the two mirrors under skills/ and plugins/ regenerate from cargo test --test integration test_docs_are_in_sync.
Review follow-up: `--branch` doesn't rescue a hook that runs outside a repository (`handle_state_set` opens with `Repository::current()`), and `clear` fails there for the same reason `set` does.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
#3847 asks for a documented "generic agent" integration: worktrunk ships plugins for Claude Code, Codex, OpenCode, and Gemini, so users of any other agent CLI have no documented way to get the 🤖/💬 activity markers in
wt list. The mechanism is already agent-agnostic — the plugins just callwt config state markeron their host's session events — but the docs only present manual markers as a personal-workflow convenience, so users reverse-engineer the integration from that section. #3571 (pi / oh-my-pi) is the same gap from a different host.Solution
A new Agent CLIs without a plugin subsection under Activity tracking in
docs/content/claude-code.md, stating the three-call contract (set 🤖 on session start, set 💬 on turn end, clear on session end) plus the three things that actually bite:--branchwhere the host pins cwd elsewhere);marker setexits non-zero outside a repository, and hosts differ on what a non-zero hook does — guard it;Docs-only. The skill and plugin-skill mirrors are regenerated by the sync test.
Testing
cargo test --test integration test_docs_are_in_syncpasses (it regenerated both mirrors, committed here).Each claim in the section was verified against a scratch repo with a linked worktree rather than taken from the existing prose:
Verification
feature-x).✗ git rev-parse --git-common-dir failed (exit 128), exit code 1 — the basis for the "guard it" bullet.marker clearwith no marker set exits 0 (○ No marker set for main), so a session-end hook is safe to run unconditionally.wt listrenders the marker in the Status column as documented.Scope
Deliberately host-agnostic. The reporter's second ask — a native
wt config plugins copilottarget — is a maintainer call and isn't attempted here: GitHub Copilot CLI does expose the needed events (sessionStart/agentStop/sessionEnd, user-level hooks under~/.copilot/hooks/, per the hooks reference), but nothing in CI can drive a Copilot session to verify a generated hook file end to end. A concrete Copilot config is posted on the issue for the reporter to confirm; if it works, adding it here as a worked example is a natural follow-up. #3594 (nativepitarget) is the adjacent in-flight work and doesn't overlap with this.Refs #3847 — automated triage