Skip to main content

Alfred — Agent Runbook: workflow routing, SOP checklists, and document management for AI agents

Project description

Alfred

Alfred

Agent Runbook

Workflow routing, SOP checklists, and document management for AI agents and humans.

PyPI Tests Python 3.10+


What is Alfred?

Alfred is a CLI-based agent runbook (af) that manages SOPs, workflows, and structured documents across three layers (PKG, USR, PRJ). It provides:

  • Workflow Routingaf guide tells AI agents which SOP to follow for any task
  • Workflow Checklistsaf plan generates step-by-step checklists from SOPs
  • Document Validationaf validate enforces metadata format, status values, and section structure
  • Document Lifecycle — Create, read, update, search, and index documents with consistent naming

Alfred is designed to be used by both AI agents (Claude Code, Codex, Gemini) and humans.

Quick Start

pip install fx-alfred
cd my-project
af guide          # see workflow routing (PKG → USR → PRJ)
af list           # list all documents
af read COR-1000  # read a specific document

Features

Workflow Routing (af guide)

Scans three layers for routing documents and outputs a complete workflow guide:

af guide --root /path/to/project
═══ PKG: COR-1103 Workflow Routing ═══
  Intent-based router: ALWAYS → PRIMARY ROUTE → OVERLAYS
  Golden rules from all COR SOPs

═══ USR: ALF-2207 Workflow Routing USR ═══
  Cross-project user preferences

═══ PRJ: FXA-2125 Workflow Routing PRJ ═══
  Project-specific decision tree

Workflow Checklists (af plan)

Generate step-by-step checklists from SOPs — optimized for LLM consumption:

af plan COR-1102 COR-1602 COR-1500    # LLM-optimized output
af plan --human COR-1102               # human-readable format
af plan --init                          # suggested prompts for agent config
# Session Workflow — Follow each phase in order.

## Phase 1: COR-1102 (Create Proposal)
- [ ] 1. Create the PRP document
- [ ] 2. Fill in required sections
- [ ] 3. Review via COR-1602

## Phase 2: COR-1602 (Multi Model Parallel Review)
- [ ] 1. Dispatch Reviewers
- [ ] 2. Both >= 9? Proceed. Otherwise revise.
⚠️ DO NOT PROCEED WITHOUT PASSING REVIEW

## RULES
- Complete each checkbox before moving to the next phase
- Declare active SOP at every phase transition

Document Validation (af validate)

Enforces document health across all layers:

af validate --root /path/to/project

Checks:

  • H1 format (# TYP-ACID: Title)
  • Per-type required metadata fields (Applies to, Last updated, Last reviewed, Status)
  • Status values against allowed set per document type
  • Change History table structure
  • SOP required sections (What Is It?, Why, When to Use, When NOT to Use, Steps)
86 documents checked, 0 issues found.

Document Management

# Create
af create sop --prefix FXA --area 21 --title "My SOP"
af create prp --prefix FXA --area 21 --title "My Proposal"

# Read
af read COR-1000                    # by PREFIX-ACID
af read 1000                        # by ACID only

# Update
af update FXA-2107 --status "Completed"
af update FXA-2107 --history "Done" --by "Claude"
af update FXA-2107 --title "New Title" -y

# Search
af search "validation"              # search content across all docs

# List & Filter
af list --type SOP                  # filter by type
af list --prefix FXA --json         # filter + JSON output

# Other
af status                           # document counts by type/layer
af index                            # regenerate project index
af changelog                        # view version history

Three-Layer Document Model

graph TD
    AF["af CLI"] --> PKG
    AF --> USR
    AF --> PRJ

    subgraph PKG ["📦 PKG (read-only)"]
        direction LR
        P1["COR-* SOPs"]
        P2["Templates"]
        P3["Bundled with fx-alfred"]
    end

    subgraph USR ["👤 USR (~/.alfred/)"]
        direction LR
        U1["Personal preferences"]
        U2["Cross-project rules"]
        U3["Routing: ALF-2207"]
    end

    subgraph PRJ ["📁 PRJ (./rules/)"]
        direction LR
        R1["Project SOPs & CHGs"]
        R2["PRPs & ADRs"]
        R3["Routing: FXA-2125"]
    end

    style PKG fill:#1a1a2e,stroke:#e94560,color:#fff
    style USR fill:#1a1a2e,stroke:#0f3460,color:#fff
    style PRJ fill:#1a1a2e,stroke:#16213e,color:#fff
Layer Location Writable Scope
PKG Bundled in package No Universal COR documents
USR ~/.alfred/ Yes Personal, cross-project
PRJ ./rules/ Yes Project-specific

Document Types

Type Purpose Example
SOP Standard Operating Procedure How to create a document
PRP Proposal Design for a new feature
CHG Change Request Modify existing system
ADR Architecture Decision Record Record a decision
REF Reference Glossary, index, contract
PLN Plan Execution schedule
INC Incident Bug report, outage record

Document Format

<PREFIX>-<ACID>-<TYP>-<Title-With-Hyphens>.md

FXA-2134-PRP-AF-Plan-Command-Workflow-Checklist.md
COR-1103-SOP-Workflow-Routing.md

For AI Agents

Session Start

af guide --root /path/to/project    # 1. See routing + decision tree
af plan COR-1102 COR-1602 COR-1500 # 2. Generate workflow checklist

First Time Setup

af plan --init                      # See suggested prompts for your agent config

Decision Tree (COR-1103)

graph TD
    START["What are you doing?"] --> Q1{"Pure document\nmanagement?"}
    START --> Q2{"Something\nbroken?"}
    START --> Q3{"New capability\nthat doesn't exist?"}
    START --> Q4{"Change existing\nsystem?"}
    START --> Q5{"Record a\ndecision?"}
    START --> Q6{"Track/discuss\na topic?"}

    Q1 -->|New SOP| COR1000["COR-1000"]
    Q1 -->|New doc| COR1001["COR-1001"]
    Q1 -->|Update| COR1300["COR-1300"]

    Q2 -->|Bug| INC["INC"]
    Q2 -->|Fix + change| INC2["INC + CHG"]

    Q3 --> PRP["PRP (COR-1102)"]
    PRP --> REV["Review (COR-1602)"]
    REV --> CHG1["CHG (COR-1101)"]
    CHG1 --> TDD1["TDD (COR-1500)"]

    Q4 -->|Standard| CHG2["CHG, no review"]
    Q4 -->|Normal| CHG3["CHG → Review → TDD"]
    Q4 -->|Emergency| CHG4["CHG → Execute → Post-approval"]

    Q5 --> ADR["ADR (COR-1100)"]
    Q6 --> DT["COR-1201\nD new / D list"]

    style START fill:#0f3460,stroke:#e94560,color:#fff
    style PRP fill:#16213e,stroke:#0f3460,color:#fff
    style REV fill:#1a1a2e,stroke:#e94560,color:#fff
    style TDD1 fill:#16213e,stroke:#0f3460,color:#fff

Key SOPs

SOP What it does
COR-1103 Workflow routing — which SOP to follow for any task
COR-1102 Create Proposal (PRP lifecycle)
COR-1101 Submit Change Request (CHG)
COR-1500 TDD Development Workflow
COR-1602 Multi-Model Parallel Review
COR-1608 PRP Review Scoring rubric
COR-1611 Reviewer Calibration Guide

Review Scoring

Alfred includes a standardized review scoring framework:

  • COR-1608 — PRP scoring (6 weighted dimensions + OQ hard gate)
  • COR-1609 — CHG scoring (5 dimensions)
  • COR-1610 — Code scoring (5 dimensions)
  • COR-1611 — Shared reviewer calibration guide

Pass threshold: >= 9.0/10. All deductions must cite specific lines.

Commands Reference

af guide [--root DIR]              Show workflow routing (PKG → USR → PRJ)
af plan SOP_ID [...] [--root DIR]  Generate workflow checklist from SOPs
af plan --human SOP_ID [...]       Human-readable checklist
af plan --init                     Suggested prompts for agent config
af list [--type] [--prefix] [--source] [--json]
af read IDENTIFIER [--json]
af create TYPE --prefix P --acid N|--area N --title T [--layer] [--subdir]
af update IDENTIFIER [--status] [--field K V] [--history] [--title] [--dry-run]
af search PATTERN
af validate [--root DIR]
af status [--json]
af index
af changelog

Install / Upgrade

pip install fx-alfred              # install
pipx install fx-alfred             # install (isolated)
pipx upgrade fx-alfred             # upgrade

Changelog

See CHANGELOG.md or run af changelog.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fx_alfred-1.0.3.tar.gz (388.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fx_alfred-1.0.3-py3-none-any.whl (114.7 kB view details)

Uploaded Python 3

File details

Details for the file fx_alfred-1.0.3.tar.gz.

File metadata

  • Download URL: fx_alfred-1.0.3.tar.gz
  • Upload date:
  • Size: 388.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fx_alfred-1.0.3.tar.gz
Algorithm Hash digest
SHA256 8b58f4cb65b22096ce6100bc62f24e36d26ef51d0e0785ad9eac49f34b8bce5c
MD5 c7bcb1443d6b368e996d8b0ca1b4e4ef
BLAKE2b-256 c837101a53ed1ba02031d96d0b06613dce691064e2b260e8a6a3e8850eb12888

See more details on using hashes here.

Provenance

The following attestation bundles were made for fx_alfred-1.0.3.tar.gz:

Publisher: publish.yml on frankyxhl/alfred

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fx_alfred-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: fx_alfred-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 114.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fx_alfred-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f729ba9a4b9c4774dd325360df141fa64a589e128ff9e1d93e64724ed1117e70
MD5 51ac14955c8b3133fd31e8b0c56e94a2
BLAKE2b-256 dfbad29dfa633fa84ce2e0fb74c44eca779570a6e7dd3457b2544c7dae3ac480

See more details on using hashes here.

Provenance

The following attestation bundles were made for fx_alfred-1.0.3-py3-none-any.whl:

Publisher: publish.yml on frankyxhl/alfred

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page