lewibs/dark-factory/phase-agent-allowlist

Claude Code and agent skill by lewibs/dark-factory

Trust tier 2
  • community
  • ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

How to restrict phase-running/phase-complete transitions in brain.json hooks to top-level orchestration agents only, preventing nested sub-agents from corrupting the phase state machine.

Install

npx vskill@latest install lewibs/dark-factory/phase-agent-allowlist

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as lewibs/dark-factory/phase-agent-allowlist.

When to use

When the dark-factory hooks track phases (e.g., planning-running, planning-complete) AND the system invokes Agent or Skill tool calls at multiple nesting depths (e.g., feature-agent calls repair-agent calls a helper agent).

Without an allowlist, every Agent tool call — including deeply nested ones — triggers a phase transition. A nested agent completion can flip a phase to complete before the actual top-level agent responsible for that phase has finished, breaking the state machine.

Steps

  1. Define the allowlist as a pipe-delimited regex string in both pre-tool-use-hook.sh and post-tool-use-hook.sh:

``bash PHASE_AGENTS="feature-agent|debugger-agent|repair-agent|code-review-orchestrator-agent|update-documentation-agent|skill-update-agent|pr-agent" ` List only the top-level orchestration agents — the ones that map 1:1 to phases in brain.json`.

  1. In pre-tool-use-hook.sh, extract the agent name from the tool input and gate the phase-running block:

```bash PHASE_AGENT_NAME="" if [ "$TOOL_NAME" = "Agent" ]; then PHASE_AGENT_NAME=$(printf '%s' "$TOOL_INPUT" | jq -r '.tool_input.subagent_type // ""') fi

if [[ "$PHASE_AGENT_NAME" =~ ^($PHASE_AGENTS)$ ]]; then # set phase *-running = true else echo "pre-tool-use-hook | set-phase-running | skipped (agent=${PHASE_AGENT_NAME} not a phase agent)" >&2 fi ```

  1. In post-tool-use-hook.sh, extract the metrics key (which equals the agent/skill name) and gate the phase-complete block:

``bash if [[ "$METRICS_KEY" =~ ^($PHASE_AGENTS)$ ]]; then # set phase *-running = false, *-complete = true else echo "post-tool-use-hook | set-phase-complete | skipped (agent=${METRICS_KEY} not a phase agent)" >&2 fi ` This block must be nested inside the if [ "$TOOL_NAME" = "Agent" ] || [ "$TOOL_NAME" = "Skill" ] block so METRICS_KEY` is already resolved.

  1. Metrics accumulation (elapsed_ms, tokens, runs) is NOT gated — it runs for all agents and skills at all depths. Only phase transitions are restricted.
  1. When adding a new top-level orchestration agent, add its subagent_type value to the PHASE_AGENTS string in both hook scripts simultaneously. Forgetting one will cause the pre-hook to start a phase but the post-hook to never complete it.

Notes

  • The METRICS_KEY in the post-hook is derived from tool_input.subagent_type for Agent calls and tool_input.name for Skill calls. Phase agents are always Agent type, so the Skill branch never triggers phase transitions by design.
  • Use ^($PHASE_AGENTS)$ (anchored regex) to prevent partial matches (e.g., repair-agent-helper accidentally matching repair-agent).
  • The allowlist lives in the hook scripts, not in brain.json, because it describes the hook's own behavior, not task state.
  • If a phase agent is retried (called more than once), the pre-hook will attempt to advance to the next unstarted phase on the retry. Ensure retry logic in the orchestrator accounts for this, or make the phase advance idempotent.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository forks
1
7-day trend score
0

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Extension points

  • hookPre/post lifecycle hooks

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/lewibs/dark-factory/phase-agent-allowlist/badge)](https://verified-skill.com/skills/lewibs/dark-factory/phase-agent-allowlist)

Something wrong with this skill or its page? Tell us.