Add Autohand Code agent integration#585
Open
igorcosta wants to merge 14 commits intoentireio:mainfrom
Open
Conversation
Register autohand-code as a new agent in the registry with its corresponding display name "Autohand Code".
Create the autohandcode package with: - Core agent struct implementing the Agent interface - Self-registration via init() - Session storage at ~/.autohand/sessions/<id>/conversation.jsonl - AUTOHAND_HOME env var support for custom home directory - Type definitions for Autohand's config format, hook stdin JSON schema, transcript message format, and file modification tool names (write_file, edit_file, create_file, patch_file)
Implement InstallHooks, UninstallHooks, AreHooksInstalled for .autohand/config.json. Hooks use Autohand's array-based config format with event/command/description fields. Installs hooks for session-start, pre-prompt, stop, session-end, and subagent-stop events. Adds permission deny rule for .entire/metadata files.
Implement ParseHookEvent mapping Autohand hooks to normalized events: - session-start -> SessionStart - pre-prompt -> TurnStart (with instruction as prompt) - stop -> TurnEnd - session-end -> SessionEnd - subagent-stop -> SubagentEnd - notification -> no-op Also implement TranscriptAnalyzer, TokenCalculator, SubagentAwareExtractor, and HookResponseWriter interfaces. Transcript path is computed from session_id since Autohand does not include transcript_path in hook stdin.
Parse Autohand's JSONL transcript format which uses direct role fields (no envelope wrapper). Extract modified files from the toolCalls array on assistant messages. Calculate token usage from _meta fields. Support subagent transcript aggregation.
86 tests covering all agent components: - autohandcode_test.go: identity, session storage, transcript I/O - hooks_test.go: install/uninstall, idempotency, force reinstall, permission rules, user hook preservation - lifecycle_test.go: event parsing for all hook types, table-driven - transcript_test.go: JSONL parsing, file extraction from toolCalls, token usage from _meta, subagent ID extraction, deduplication
Add blank imports in config.go and hooks_cmd.go to trigger init() self-registration. This makes autohand-code available in the agent registry and generates hook subcommands under entire hooks autohand-code.
Apply gofmt -s -w to fix struct tag alignment and spacing issues in types.go and hooks.go.
Verify entire enable --agent autohand-code: - Installs all 5 required hooks in .autohand/config.json - Adds permission deny rule for .entire/metadata/** - Preserves existing user hooks and custom config fields
Add Autohand Code and Factory AI Droid to the agent implementations list in the Key Directories section.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Autohand Code as a first-class agent integration in Entire CLI, following the established agent strategy pattern (hooks + lifecycle events + transcript parsing/token usage) so Autohand sessions can be captured and analyzed like other supported agents.
Changes:
- Introduces
cmd/entire/cli/agent/autohandcode/implementing agent identity, hook installation/uninstall, lifecycle parsing, transcript analysis, and token accounting. - Registers the new agent via blank imports and adds new agent name/type constants to the registry.
- Adds extensive unit tests and an integration test to validate hook installation into
.autohand/config.json.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/entire/cli/integration_test/setup_autohand_hooks_test.go | Integration coverage ensuring entire enable --agent autohand-code writes hooks + deny rule to .autohand/config.json. |
| cmd/entire/cli/hooks_cmd.go | Ensures Autohand agent is registered before hook subcommands enumerate agents. |
| cmd/entire/cli/config.go | Ensures Autohand agent self-registers during CLI initialization. |
| cmd/entire/cli/agent/registry.go | Adds AgentNameAutohandCode / AgentTypeAutohandCode constants. |
| cmd/entire/cli/agent/autohandcode/types.go | Defines Autohand config schema + transcript/hook payload types used across the integration. |
| cmd/entire/cli/agent/autohandcode/transcript.go | Implements JSONL parsing, modified-file extraction, subagent detection, and token usage aggregation. |
| cmd/entire/cli/agent/autohandcode/lifecycle.go | Implements lifecycle hook parsing + transcript analyzer/token calculator adapters for Entire’s normalized event model. |
| cmd/entire/cli/agent/autohandcode/hooks.go | Implements .autohand/config.json hook installation/uninstall and permissions deny rule management. |
| cmd/entire/cli/agent/autohandcode/transcript_test.go | Unit tests for transcript parsing, file extraction, subagent handling, prompts/summary, and token logic. |
| cmd/entire/cli/agent/autohandcode/lifecycle_test.go | Unit tests for lifecycle hook parsing and hook response writer behavior. |
| cmd/entire/cli/agent/autohandcode/hooks_test.go | Unit tests for hook installation/uninstall idempotency, preservation, and permissions deny rule behavior. |
| cmd/entire/cli/agent/autohandcode/autohandcode_test.go | Unit tests for agent identity, session dir resolution, transcript read/write, and session round-trips. |
| cmd/entire/cli/agent/autohandcode/autohandcode.go | New agent implementation + self-registration with the agent registry. |
| CLAUDE.md | Documentation update to include Autohand Code in the agent list. |
Co-authored-by: Copilot <[email protected]>
Doesn't change the functionality. Just name convention. Co-authored-by: Copilot <[email protected]>
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.
We're delighted to join the alliance, this
PRintroduces Autohand code cli to it.autohand-codeas a new agent in the Entire CLI, following the same pattern asthe Factory AI Droid integration (Add Factory AI Droid agent integration #435)
parsing, transcript analysis, and token calculation
.autohand/config.json(session-start, pre-prompt, stop,session-end, subagent-stop) plus a permission deny rule for
.entire/metadata/**extracted from
toolCallsarrays and token usage from_metafieldsNew Files
cmd/entire/cli/agent/autohandcode/- Full agent package (autohandcode.go,types.go, hooks.go, lifecycle.go, transcript.go)
cmd/entire/cli/agent/autohandcode/*_test.go- Unit tests (4 files)cmd/entire/cli/integration_test/setup_autohand_hooks_test.go- Integration testsModified Files
cmd/entire/cli/agent/registry.go- Added agent name/type constantscmd/entire/cli/config.go- Added blank import for self-registrationcmd/entire/cli/hooks_cmd.go- Added blank import for hook subcommandsCLAUDE.md- Updated agent listTest plan
mise run test- all unit tests passmise run test:integration- integration tests pass with race detectionmise run lint- no lint issuesentire enable --agent autohand-codeinstalls hooks to.autohand/config.jsonentire hooks autohand-code <event>andverify processing