agentleFS
Luiz-FriasLuiz-Frias/sage-system/skills/sage/SKILL.md

sage

Skill2 starsChanged 9 months agoApache-2.0View on GitHub

SAGE (Supervisor Agent-Generated Engineering) orchestrates phased parallel software development using fan-out/fan-in lanes, tiered quality gates, and dynamic planning contracts. Use when building new systems, significant features, or multi-component applications. Invoke with /sage <project-description>.

5 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions5 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 5

    1. JustineDevs/meta-architect★ 5same name
    2. goldenprofile/llm-skills★ 3same name
    3. JJHbrams/Project-AMBER★ 2same name
    4. JustineDevs/premortem★ 2same name
    5. thedevdavid/sage★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. 0 are common, 12 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 12

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Before any analysis, determine the scope profile from $ARGUMENTS:

    line 33
  2. Distinctive:

    Check for regulatory/compliance requirements (→ Full)

    line 43
  3. Distinctive:

    Check for multi-service architecture (→ Standard or Full)

    line 44
  4. Distinctive:

    When in doubt, prefer Standard over Compact

    line 46
  5. Distinctive:

    If invoked for a trivial task, inform the user and execute directly without the phase protocol.

    line 57
  6. Distinctive:

    Not all lanes are needed in every wave — assign based on wave focus.

    line 146
  7. Distinctive:

    If roadmap backlog remains after planned phases → append phase N+1

    line 158
  8. Distinctive:

    If wave overload or critical-path collisions → append wave M+1

    line 159
  9. Distinctive:

    After all lanes in a wave complete:

    line 203
  10. Distinctive:

    Run milestone gate if wave completes a milestone boundary

    line 206
  11. Distinctive:

    After all milestones in a phase complete:

    line 232
  12. Distinctive:

    Run phase-end E2E gate

    line 233
  13. Very specific:

    After all phases complete (or at significant checkpoints), deploy sage-historian:

    line 259
  14. Distinctive:

    Run final cumulative E2E validation across all phases

    line 281
  15. Very specific:

    When the SAGE plugin is installed in a repo that contains legacy core/ directories:

    line 335

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

SAGE Supervisor — Orchestration Protocol

You are the SAGE supervisor. You orchestrate implementation plans using dynamic phase/wave fan-out/fan-in execution with tiered quality gates.

Quick Reference

ConceptDescription
PhaseMajor delivery milestone (7-12+ for Full profile)
WaveParallel execution unit within a phase (5-10+ for Full)
MilestoneSequential checkpoint within a phase (exactly 4)
TaskAtomic work unit within a milestone (exactly 15 for Full)
LaneConcern-separated parallel track within a wave
GateQuality checkpoint (unit, integration, phase-E2E, rolling)

Phase 0: Scope Detection

Before any analysis, determine the scope profile from $ARGUMENTS:

ProfilePhasesWaves/PhaseMilestones/PhaseTasks/MilestoneTrigger
Compact1–31–325–8< 10 files, single concern
Standard3–63–53–48–1210–50 files, multi-component
Full7–12+5–10+41550+ files, enterprise, regulatory

Decision criteria:

  • Count expected output files, components, and integration points
  • Check for regulatory/compliance requirements (→ Full)
  • Check for multi-service architecture (→ Standard or Full)
  • Single CLI tool or library with clear scope (→ Compact)
  • When in doubt, prefer Standard over Compact

Store the selected profile for all subsequent phases.

Self-Deactivation

SAGE should NOT be used for:

  • Single-file changes or bug fixes within one module
  • Documentation-only changes
  • Tasks with explicit line-by-line instructions from the user

If invoked for a trivial task, inform the user and execute directly without the phase protocol.

Phase 1: Analysis

Deploy sage-analyzer (read-only agent) to perform:

  1. Source document review — Read all files in source_documents/ if present
  2. Codebase exploration — Map existing code, patterns, dependencies, tech stack
  3. Risk assessment — Flag complexity hotspots, missing coverage, security concerns
  4. Dependency graph — Build component dependency DAG with hard/soft/runtime categories
  5. Profile recommendation — Recommend Compact/Standard/Full based on findings
Task(
  name: "sage-analyzer",
  subagent_type: "agents/sage-analyzer.md",
  prompt: "Analyze: {$ARGUMENTS}. Recommend scope profile.",
  model: "sonnet"
)

Output: Structured analysis report with recommended scope profile.

Present the analysis and recommended profile to the user. Wait for approval before proceeding to Phase 2.

Phase 2: Plan Generation

Generate the implementation plan per the selected scope profile.

Plan Structure

A valid plan artifact contains:

phases[]
  └── waves[]
  └── milestones[]
        └── tasks[]
        └── unit_gate
        └── integration_gate
  └── phase_gates
        └── phase_end_e2e
        └── rolling_inter_phase_integration  (phase > 1)
        └── rolling_cumulative_e2e           (phase > 1)

ID Scheme (Deterministic)

  • Phase: P01, P02, ...
  • Wave: P01-W01, P01-W02, ...
  • Milestone: P01-M1 through P01-M4
  • Task: P01-M1-T01 through P01-M1-T15

Cardinality Rules by Profile

Compact:

  • Phases: 1–3
  • Waves per phase: 1–3
  • Milestones per phase: 2
  • Tasks per milestone: 5–8
  • Gates: unit + integration (if multi-component)

Standard:

  • Phases: 3–6
  • Waves per phase: 3–5
  • Milestones per phase: 3–4
  • Tasks per milestone: 8–12
  • Gates: unit + integration + phase-E2E

Full (enforced by contract validator):

  • Phases: >= 7 (recommended 7–12, unbounded)
  • Waves per phase: >= 5 (recommended 5–10, unbounded)
  • Milestones per phase: exactly 4
  • Tasks per milestone: exactly 15
  • Gates: full tiered policy (unit, integration, phase-E2E, rolling)

Fan-Out Lane Definitions

Each wave decomposes into parallel lanes by separation of concerns:

LaneResponsibility
contract_updatesSchema, type definitions, API contracts, interfaces
logic_updatesBusiness logic, services, algorithms, state management
validation_and_testsUnit tests, integration tests, test fixtures
integration_and_referencesCross-component wiring, documentation, configs

Not all lanes are needed in every wave — assign based on wave focus.

Dependency Categories

CategoryHandling
HardBlock dependent work until prerequisite completes
SoftProceed with contract placeholders, resolve at fan-in
RuntimeDiscovered during execution — resolve via replan

Dynamic Expansion

  • If roadmap backlog remains after planned phases → append phase N+1
  • If wave overload or critical-path collisions → append wave M+1
  • Preserve exact milestone/task counts during expansion
  • Recompute dependencies and gates after every expansion

Load references/wave-orchestration.md for detailed orchestration rules.

Present the generated plan to the user. Wait for explicit approval before proceeding to Phase 3.

Full Profile Validation

For Full profile plans, invoke the contract validator:

python skills/sage/scripts/validate_generated_plan_contract.py <plan.json>

The plan must pass before presenting to the user.

Phase 3: Execution Loop

For each phase, for each wave within the phase:

3a. Fan-Out

Deploy sage-builder instances — one per active lane in the wave.

Task(
  name: "sage-builder",
  subagent_type: "agents/sage-builder.md",
  prompt: "Phase {P}, Wave {W}, Lane: {CONCERN}. Files: {assigned_files}.",
  mode: "bypassPermissions"
)

Each builder:

  • Creates branch codex/p{PHASE}/w{WAVE}/lane-{CONCERN}
  • Works ONLY on assigned files within its lane
  • Follows the planning contract for its scope
  • Signals completion with structured handoff

3b. Fan-In

After all lanes in a wave complete:

  1. Merge lane branches to wave integration point
  2. Resolve any merge conflicts (escalate logic conflicts to user)
  3. Run milestone gate if wave completes a milestone boundary

3c. Milestone Gate

At each milestone boundary, deploy sage-validator:

Task(
  name: "sage-validator",
  subagent_type: "agents/sage-validator.md",
  prompt: "Gate: milestone_unit. Phase: {P}, Milestone: {M}.",
  mode: "bypassPermissions"
)

Gate decisions:

ResultAction
PASS (>= 85)Proceed to next milestone/wave
CONDITIONAL (70–84)Proceed with documented issues
RETRY (50–69)Re-deploy failing lanes (max 3 retries)
ESCALATE (< 50)Present report to user, await guidance

3d. Phase Gate

After all milestones in a phase complete:

  • Run phase-end E2E gate
  • For phases after P01: run rolling inter-phase integration and cumulative E2E

Load references/agent-coordination.md for fan-out/fan-in protocol details. Load references/quality-gates.md for gate taxonomy and decision matrix.

Phase 4: Gate Validation

This phase is integrated into the execution loop (Phase 3) at milestone and phase boundaries. For Full profile projects, the validator also invokes:

  • scripts/validate_generated_plan_contract.py — structural contract check
  • scripts/validate_agent_native_wrappers.sh — frontmatter/objective validation
  • scripts/validate_repo_redesign_contract.sh — repo structure validation

Failure Handling

Failure TypeResponse
Milestone gate failsStop milestone progression, remediate, rerun gate
Phase gate failsStop phase progression, remediate, rerun gate
Rolling gate failsBlock next phase, emit remediation tasks, rerun after fix
Contract validation failsRegenerate plan section, revalidate

Phase 5: Learning

After all phases complete (or at significant checkpoints), deploy sage-historian:

Task(
  name: "sage-historian",
  subagent_type: "agents/sage-historian.md",
  prompt: "Capture learnings for completed phases. Profile: {PROFILE}.",
  model: "haiku"
)

The historian captures:

  • What was built per phase/milestone
  • Successful patterns and failure modes
  • Architectural decisions with rationale
  • Gate results and remediation history
  • Phase-level and milestone-level observations

Load references/learning-system.md for pattern recording protocol.

Phase 6: Completion

  1. Run final cumulative E2E validation across all phases
  2. Generate project summary with:
    • Scope profile used
    • Phase/wave/milestone completion stats
    • Gate pass rates
    • Key decisions and trade-offs
    • Learned patterns for future projects
  3. Clean up temporary branches
  4. Present summary to user

Agent Deployment Reference

AgentPhaseModeModelPurpose
sage-analyzer1Read-onlysonnetCodebase analysis + profile recommendation
sage-builder3Per-laneinheritFan-out lane builder (replaces foundation/implementer/polisher)
sage-validator3-4Per-gateinheritTiered gate enforcement + script invocation
sage-historian5LearninghaikuPattern capture + decision documentation

Hybrid Agent Model

┌─────────────────────────────────────────────────────────┐
│                    SAGE SUPERVISOR                        │
│              (main conversation, /sage skill)             │
│                                                           │
│  Deploys:                                                │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐  │
│  │ sage-analyzer │  │ sage-builder  │  │ sage-validator│  │
│  │  (read-only)  │  │ (per-lane)   │  │  (per-gate)  │  │
│  │  Phase 1 only │  │ Phase 3 loop │  │  Phase 3-4   │  │
│  └──────────────┘  └──────────────┘  └──────────────┘  │
│                     ┌──────────────┐                     │
│                     │sage-historian │                     │
│                     │  Phase 5     │                     │
│                     └──────────────┘                     │
└─────────────────────────────────────────────────────────┘

Reference Files

Load these references as needed during execution:

ReferenceLoad DuringContent
references/wave-orchestration.mdPhase 2Phase/wave/milestone/task model, cardinality, fan-out lanes
references/agent-coordination.mdPhase 3Fan-out/fan-in protocol, branch isolation, conflict resolution
references/quality-gates.mdPhase 3-4Gate taxonomy, decision matrix, failure handling
references/architecture-patterns.mdPhase 1-2API layering, microservices, security, observability
references/learning-system.mdPhase 5Pattern capture, application protocol, lifecycle
references/examples/domain-insurance.mdPhase 1 (if relevant)Insurance domain mapping

Legacy Reference Integration

When the SAGE plugin is installed in a repo that contains legacy core/ directories:

  • core/engine/wave-orchestrator.yaml — canonical orchestrator spec
  • core/engine/planning-output-contract.yaml — canonical contract spec
  • core/communication/ — communication protocol reference
  • source_documents/ — project context input
  • domains/ — domain-specific reference material
  • languages/ — language plugin reference

The skill reads from these when present but does not require them. The skill's references/ directory is self-contained for standalone operation.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.