Skip to content

docs(agents): document the activity-marker contract for agent CLIs without a plugin - #3848

Merged
max-sixty merged 2 commits into
mainfrom
feat/issue-3847-generic-agent-markers
Aug 18, 2026
Merged

docs(agents): document the activity-marker contract for agent CLIs without a plugin#3848
max-sixty merged 2 commits into
mainfrom
feat/issue-3847-generic-agent-markers

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

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 call wt config state marker on 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:

  • the command resolves the branch from its working directory, so the hook must run inside the worktree (--branch where the host pins cwd elsewhere);
  • marker set exits non-zero outside a repository, and hosts differ on what a non-zero hook does — guard it;
  • pair every set with a clear, and expect a stale marker if the process is killed first.

Docs-only. The skill and plugin-skill mirrors are regenerated by the sync test.

Testing

cargo test --test integration test_docs_are_in_sync passes (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
$ wt config state marker set "🤖"          # from /tmp/mrepo.feature-x
✓ Set marker for feature-x to 🤖
$ git config --get worktrunk.state.feature-x.marker
{"marker":"🤖","set_at":1787044121}
  • Works from a subdirectory of the worktree (branch still resolves to feature-x).
  • Outside a repository: ✗ git rev-parse --git-common-dir failed (exit 128), exit code 1 — the basis for the "guard it" bullet.
  • marker clear with no marker set exits 0 (○ No marker set for main), so a session-end hook is safe to run unconditionally.
  • wt list renders the marker in the Status column as documented.

Scope

Deliberately host-agnostic. The reporter's second ask — a native wt config plugins copilot target — 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 (native pi target) is the adjacent in-flight work and doesn't overlap with this.


Refs #3847 — automated triage

…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 worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Comment thread docs/content/claude-code.md Outdated
Comment thread docs/content/claude-code.md Outdated
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.
@max-sixty
max-sixty merged commit a6f26e5 into main Aug 18, 2026
44 checks passed
@max-sixty
max-sixty deleted the feat/issue-3847-generic-agent-markers branch August 18, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-fix Automated CI fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants