Agent lifecycle manager

From 5throck/ai-workspace-standards · View interactive version

Agent lifecycle manager is an AI agent skill from the GitHub repository 5throck/ai-workspace-standards. Manages the creation, validation, and maintenance of AI agent files across the project, including PM-led hiring (creation) and firing (deprecation/removal) of agents with their skill packages. Use when: creating new agents, hiring or firing agents, updating agent metadata/frontmatter, validating age

How to use this skill

Skill file

Overview

This skill provides a systematic approach to creating, validating, and maintaining AI agent files (agents/*.md). It ensures all agents follow proper structure, have correct YAML frontmatter (status, tier, role, etc.), and are properly registered in the central AGENTS.md registry.

When to Use This Skill

Create New Agent:

Validate Existing Agents:

Update Agent Status/Metadata:

Hire an Agent (PM-decided):

Fire an Agent (PM-decided):


Step 1: Create or Update Agent File

Purpose: Create or modify an agent file in the agents/ directory.

Steps:

  1. Navigate to the agents/ directory in the project root.
  2. Create or edit agents/<agent-name>.md using kebab-case naming.
  3. (Optional) Run bun scripts/agent-create.ts <agent-name> if you want to use the automated scaffolding script.

Step 2: Write Agent Frontmatter

Purpose: Define agent metadata using the standard YAML frontmatter specification.

Required Frontmatter Structure:

---
name: agent-name
role: "Brief 2-4 word title"
status: active
description: "Short sentence on what the agent does"
tier: high | medium | low
---

Validation:


Step 3: Write Agent Content

Purpose: Document the agent's system prompt and behavioral instructions.

Content Guidelines:


Step 4: Update AGENTS.md Registry

Purpose: Register the agent in the project's central orchestrator document.

Steps:

  1. Open AGENTS.md in the project root.
  2. Add a new row to the appropriate table (Orchestration, Design, Execution, Security).
  3. Ensure the format matches: | Agent Role | agents/agent-name.md | Tier | Role description |

Changing an Agent's Tier

Purpose: Keep every tier declaration surface in sync when a tier changes.

Tier is declared in exactly one place: the agent file's scalar tier: high|medium|low frontmatter line (ADR-0102). The schema's only tier-related block is models, which maps tier→model per platform — never edit it to change an agent's tier. Update surfaces in this order:

  1. agents/<name>.md frontmatter scalar tier: line (the declaration — change this first)
  2. AGENTS.md §1 Agent Roster and §4.1 Subagent Roster Tier cells
  3. docs/lifecycle/agents/<name>.md **Tier**: field (and any stale tier prose)

Then run the tier drift check — it must pass before the change lands:

bun scripts/lifecycle-sync-audit.ts   # Check F: tier cross-surface parity (frontmatter anchor)

Step 5: Validate Agent Lifecycle

Purpose: Ensure the agent passes all programmatic lifecycle audits.

Run Validation Scripts:

To run a comprehensive audit across all agents:

bun scripts/agent-lifecycle-audit.ts

To verify a specific agent:

bun scripts/agent-verify.ts <agent-name>

To verify tier consistency across all tier surfaces (frontmatter, AGENTS.md rosters, lifecycle records):

bun scripts/lifecycle-sync-audit.ts   # Check F

Validation Checklist:


Hiring Workflow (PM-decided)

PM decides when to hire autonomously — no blocking user approval. A hiring decision is recorded and executed through dispatch:

| Role | Duty |

|------|------|

| PM | Detect signal, define role, decide, emit decision record, dispatch |

| automation-engineer | Execute file edits (agent file, registry) |

| lifecycle-manager | Update governance records, publish L0→L1 |

Step H1: Detect Signal and Check Duplication

Hiring signals (any one suffices, evidence goes in the decision record):

Before proceeding, verify the role does not duplicate an existing agent: review the current roster (agents/*.md frontmatter and the AGENTS.md §1 roster) and check whether re-tiering, re-scoping, or a skill attach would cover the need instead.

Step H2: Define the Role

Step H3: Assemble the Initial Skill Package

The initial skill package is part of the hiring decision (PM-decided). For each required capability:

  1. Search skills/*/SKILL.md for an existing skill covering it
  2. Found → attach: set/extend the skill's owner: to include the new agent (see Skill Attach/Detach Rules below)
  3. Not found → file a skill create request through the Skill Request Workflow in skill-lifecycle-manager (agent-initiated, PM-approved); execution may follow after hiring

Step H4: Record the Decision

Before any dispatch:

  1. Emit a Gate-Moment Decision Record at docs/decisions/DEC-YYYYMMDD-NN.md (ADR-0061). The record must carry the ADR-0061 required frontmatter fields (id, date, agent, decision, alternatives, status); validate with bun scripts/validate-decisions.ts. Content: signal, evidence, role definition, skill package, alternatives considered (re-scope/attach existing agent)
  2. Append a summary entry to the active memory/YYYY-MM-DD.md

Step H5: Execute via Dispatch

PM dispatches automation-engineer (never edits files directly):

  1. Create agents/<name>.md — write it directly (recommended) or via bun scripts/agent-create.ts <agent-name>; the file must contain all schema-required frontmatter fields (name, role, status, tier, version, last_reviewed, description, lifecycle per schemas/agent.schema.json)
  2. Register the agent in the AGENTS.md §1 Agent Roster table (| Agent Role | agents/agent-name.md | Tier | Role description |)
  3. Apply the skill package owner updates (Step H3)
  4. Create the governance record docs/lifecycle/agents/<name>.md (Created date, empty Phase History, Metadata with Owner + Current Phase production)
  5. lifecycle-manager then updates governance records, regenerates the derived artifacts (bun scripts/generate-version-manifest.ts, bun scripts/generate-skill-graph.ts), and publishes via bun run propagate:apply

Step H6: Validate

bun scripts/agent-lifecycle-audit.ts   # all-agent audit
bun scripts/lifecycle-sync-audit.ts    # Check F: tier cross-surface parity

Both must pass before the hiring is considered complete.


Firing Workflow (PM-decided)

PM decides when to fire autonomously. Default exit is deprecation (reversible); hard delete requires an explicit user request.

Step F1: Detect Signal and Analyze Dependencies

Firing signals:

Dependency analysis before deciding — map everything that breaks if the agent exits:

  1. Owned skills: reverse-lookup owner: across skills/*/SKILL.md
  2. Handoff relations: handoff_to / handoff_from in the agent definition and dispatch templates
  3. Phases: phases where the agent is lead or supporting
  4. Roster references: AGENTS.md §1/§4.1 rows, docs/lifecycle/agents/<name>.md

Step F2: Plan Skill Disposition

The disposition plan is part of the firing decision — the fired agent cannot request anything:

Step F3: Record the Decision

Before any dispatch:

  1. Emit a Gate-Moment Decision Record at docs/decisions/DEC-YYYYMMDD-NN.md (ADR-0061) with the required frontmatter fields; validate with bun scripts/validate-decisions.ts. Content: signal, dependency map, disposition plan, exit mode (deprecate vs delete)
  2. Append a summary entry to the active memory/YYYY-MM-DD.md

Step F4: Execute via Dispatch

PM dispatches automation-engineer:

Default — deprecate:

  1. Set status: deprecated in the agent frontmatter (keep the file and governance record in place)
  2. Schedule the removal review: set removal_review: YYYY-MM-DD in the agent frontmatter (default: deprecation + 90 days) — the quarterly roster review consumes it, and agent-lifecycle-audit.ts FAILS once the date passes without a review decision
  3. Apply the skill disposition plan (Step F2)
  4. Update AGENTS.md roster cells (mark deprecated; do not delete the row yet)
  5. lifecycle-manager updates governance records, regenerates derived artifacts (generate-version-manifest.ts, generate-skill-graph.ts), and publishes L0→L1

Hard delete — explicit user request only:

  1. Confirm the user explicitly asked for deletion (not just "fire" in passing)
  2. Run bun scripts/agent-delete.ts <name> --force
  3. Remove the AGENTS.md §1/§4.1 roster rows
  4. Complete the skill disposition plan — no orphaned skills may remain
  5. lifecycle-manager updates governance records, regenerates derived artifacts, and publishes L0→L1

Step F5: Validate

bun scripts/agent-lifecycle-audit.ts
bun scripts/lifecycle-sync-audit.ts

The audit now enforces the reference sweep mechanically: Check 13 fails on dangling handoff_to/handoff_from references to the fired agent, and the skill-disposition checks fail on any skill left with the fired agent as sole (or now-nonexistent) owner:. Confirm both in the audit output — these are no longer prose-only checks.


Skill Attach/Detach Rules

Skill-to-agent binding lives in the skill frontmatter owner: field. Keep both surfaces consistent — the skill's owner: and the agent's own capability descriptions must tell the same story.


Expected Outputs


Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.