Skip to content

Feature: Factory Droid adapter (plugin + hooks + portability doc) #167

@Duy-Nguyen-2006

Description

@Duy-Nguyen-2006

Summary

Add a Factory Droid adapter so ponytail works with the same depth as the Claude Code / Codex plugins: always-on rules, intensity levels (lite / full / ultra / off), and the five skills as slash commands.

There is no existing issue or PR for Droid/Factory in this repo. docs/agent-portability.md lists 13+ hosts but not Factory Droid.

Why Droid is a good fit

Factory Droid already supports the same building blocks ponytail uses elsewhere:

Ponytail piece Droid equivalent
skills/*/SKILL.md ~/.factory/skills/ or .factory/skills/ (skills)
AGENTS.md Auto-discovered at repo root / ~/.factory/AGENTS.md (AGENTS.md)
SessionStart + UserPromptSubmit hooks Same event names (hooks reference)
Claude plugin layout Droid is Claude Code plugin compatible; plugins use ${DROID_PLUGIN_ROOT} instead of ${CLAUDE_PLUGIN_ROOT}

Droid’s UserPromptSubmit / SessionStart hooks can inject additionalContext via JSON stdout—the same pattern Codex uses in hooks/ponytail-runtime.js.

Proposed adapter (keep adapters thin)

Per docs/agent-portability.md, point the host at existing assets:

  1. .factory-plugin/plugin.json (manifest; mirror .claude-plugin/plugin.json fields).
  2. hooks/hooks.json (or hooks/factory-hooks.json if root hooks.json must stay host-specific—see Gemini CLI: Invalid hook event name 'UserPromptSubmit' warning #137 / PR Avoid Gemini loading Claude hook events #139 pattern for Gemini vs Claude/Codex).
    • SessionStartnode "${DROID_PLUGIN_ROOT}/hooks/ponytail-activate.js"
    • UserPromptSubmitnode "${DROID_PLUGIN_ROOT}/hooks/ponytail-mode-tracker.js"
  3. skills/ — unchanged (plugin bundles or references repo skills/).
  4. commands/ — optional slash prompts for /ponytail, /ponytail-review, etc. (Droid merges commands into skills slash namespace).
  5. docs/agent-portability.md — new row: Factory Droid | .factory-plugin/, skills/, hooks/, AGENTS.md | Plugin install + hooks; instruction-only fallback via AGENTS.md + skills copy.

Code changes likely needed (small)

  • hooks/ponytail-runtime.js: detect DROID_PLUGIN_ROOT (and/or Factory-specific env) for state path + writeHookOutput JSON shape for Droid (same as Codex hookSpecificOutput on SessionStart / UserPromptSubmit).
  • hooks/ponytail-config.js: state file location — today ~/.claude/.ponytail-active; consider ~/.factory/.ponytail-active when running under Droid (or host-agnostic getStateDir()).
  • Deactivation fix (Ponytail silently turns off when a prompt happens to contain "normal mode" #161 / PR fix: only deactivate ponytail on a standalone stop command #162): when touching ponytail-mode-tracker.js, use standalone isDeactivationCommand so prompts like “add a normal mode toggle” do not silently disable ponytail on Droid too.

Install UX (document in README)

droid plugin marketplace add https://github.com/DietrichGebert/ponytail
droid plugin install ponytail@ponytail --scope user   # or project

Users must review/trust hooks in /hooks (same as Codex). Requires node on PATH for lifecycle hooks.

Instruction-only fallback (no hooks): copy AGENTS.md + skills/ into project or ~/.factory/ — same as Generic agents row, without lite/full/ultra persistence.

Acceptance criteria

  • Plugin installs via droid plugin from this repo’s marketplace manifest.
  • New session injects ponytail rules at default mode (full unless PONYTAIL_DEFAULT_MODE / config).
  • /ponytail lite|full|ultra|off (or equivalent command) changes mode for the session.
  • All five skills discoverable; /ponytail-review, /ponytail-audit, /ponytail-debt, /ponytail-help work.
  • node scripts/check-rule-copies.js and existing hook tests still pass; add a manifest test for Factory hook paths if the repo already tests other hosts.
  • docs/agent-portability.md updated; README install section mentions Droid.

References

Happy to help test a PR on Linux with droid CLI if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions