Skip to content

feat: Agency plugin manifests + PostToolUse hook (Phase 1)#43

Merged
vidhartbhatia merged 2 commits into
mainfrom
phase1-agency-manifests
May 26, 2026
Merged

feat: Agency plugin manifests + PostToolUse hook (Phase 1)#43
vidhartbhatia merged 2 commits into
mainfrom
phase1-agency-manifests

Conversation

@vidhartbhatia
Copy link
Copy Markdown
Collaborator

Summary

Phase 1 of cross-engine support: adds Agency plugin manifests and a classification-only PostToolUse hook. Also fixes a bug where session activity rows in work-log.md rendered blank when the host didn't provide finalMessage.

What's new

  • Agency manifests: agency.json, .mcp.json, hooks/hooks.json — declares the extension to Agency-compatible hosts
  • PostToolUse hook: hooks/post-tool-use.mjs — classifies tool calls (file edits, PR creation, git actions, brag requests) via lib/heuristics.mjs, returns { continue: true, classification: {...} } to stdout
  • Session summary fix: lib/render.mjs now falls back to record.taskDescription when summary is absent, fixing blank rows in the session activity table

Design decisions

  • Classification only (no persistence): The hook classifies but does not write to disk. Persistence requires SessionStart/SessionEnd hooks for session-key management, deferred to Phase 2. This was reviewed and approved by a 3-model council (GPT-5.5, Opus 4.7, Sonnet 4.5).
  • 6 Phase 2 invariants documented in docs/cross-engine-spec.md to guide future work.

Docs updated

  • README: runtime compatibility table
  • AGENTS.md: architecture map, test counts (184), distribution table, navigation
  • CHANGELOG: new entries under [Unreleased]
  • docs/cross-engine-spec.md: Phase Status table + Phase 2 invariants
  • docs/testing-strategy.md: hooks coverage row, updated counts

Tests

  • 184 tests passing (up from 177 at Phase 0 merge)
  • New: test/hooks.test.mjs (6 subprocess tests) + test/render.test.mjs taskDescription fallback test
  • Cross-platform: tested on Windows, CI covers ubuntu/macos/windows × Node 18/20/22

Checklist

  • No new runtime dependencies
  • package.json files array updated
  • release.yml required array updated
  • CHANGELOG entry added
  • All 184 tests pass
  • Code reviewed by Opus 4.7 (MERGE verdict)

vidhartbhatia and others added 2 commits May 13, 2026 14:38
Add Agency plugin support with:
- agency.json: governance layer 4, developer-tools category
- .mcp.json: stdio MCP server config for Agency hosts
- hooks/hooks.json: PostToolUse hook declaration
- hooks/post-tool-use.mjs: classify tool calls via lib/heuristics.mjs
- .claude-plugin/plugin.json: add hooks reference, remove stale version

Hook script uses lazy dynamic imports with pathToFileURL for Windows
compatibility. Reads JSON from stdin, returns JSON on stdout — no
console.log pollution (tested via subprocess).

test/hooks.test.mjs adds 6 subprocess tests covering file edits, PR
creation, unrecognized tools, malformed input, stdout purity, and
camelCase payload compatibility.

Updated package.json files array and release.yml required array for
all new files.

183 tests passing (was 177).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- render: fall back to taskDescription when session summary is absent,
  fixing blank rows in work-log session activity table
- hooks: add trailing newline to stdout, fix malformed-input test to
  send actual non-JSON bytes, add Phase 2 invariants to JSDoc
- docs: add README runtime compatibility table (council requirement),
  update AGENTS.md architecture map + test counts (184),
  update cross-engine-spec with Phase Status + Phase 2 invariants,
  update testing-strategy.md with hooks coverage
- CHANGELOG: add Agency manifests + session summary fix entries

184 tests passing, all council conditions addressed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vidhartbhatia vidhartbhatia requested a review from a team as a code owner May 22, 2026 22:40
@vidhartbhatia vidhartbhatia merged commit a0d9a65 into main May 26, 2026
14 checks passed
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.

1 participant