Skip to content

Automations for Factory Droid: Claude-compatible hooks, with a recursion guard for droid exec #249

Backlog

Description

@vsn411

Part of #240. Builds on #242 and #241. Packaging: #227 (Factory Droid row).

What Factory Droid offers (checked against the docs on 2026-12-03)

Source: Hooks reference (now served from docs.factory.com).

  • Config: ~/.factory/hooks.json (user), .factory/hooks.json at the git root (project), or hooks in settings.json / settings.local.json, a --settings file, or org-managed settings. A hooks.json replaces settings.json hooks for the same event in the same directory.
  • Events: PreToolUse, PostToolUse, UserPromptSubmit, Notification, Stop, SubagentStop, PreCompact, SessionStart, SessionEnd. The format is close to Claude Code's.
  • Control:
    • Exit 2 blocks where the event can block.
    • PostToolUse / Stop feed stderr back to Droid.
    • Stop with decision: "block" + reason keeps Droid going. The input has stop_hook_active.
    • The PostToolUse edit matcher is e.g. Create|Edit|ApplyPatch.
  • Timeout: default 60 s.
  • Hooks run under droid exec. Folder trust does not disable project hooks there.

Recipe mapping

The same as Claude Code (#243). Reuse that host adapter where the payloads match, and only override what differs.

Recipe Droid event
commit-guard PreToolUse (shell tool) → block + reason
turn-review Stop → decision: "block" + findings; respect stop_hook_active
dependency-watch etc. PostToolUse (`Create
session-brief / session-flush SessionStart / SessionEnd

Gotchas

Tasks

  • hosts/droid.py (subclass of the Claude adapter if the payloads match) + fixtures
  • enable --tool droid writes .factory/hooks.json / ~/.factory/hooks.json
  • Recursion guard verified with a real nested droid exec run
  • Verification row: droid version, OS, recipes, portal shows trigger.host = "droid"

Done when

The recipes work against a real Droid install. The recursion test passes. Every run reports back.

Activity

  1. added
    enhancement
    help wanted
    difficulty: medium
    on Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty: mediumenhancementhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions