# aigorahub/elves architecture

> Architecture diagram of the GitHub repository aigorahub/elves, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aigorahub/elves
- Repository: https://github.com/aigorahub/elves

## Overview

1. **What this repository is**
   - Elves is not an application runtime; it is a **portable agent skill/control plane** for running long autonomous coding sessions.
   - The repo packages the instructions, templates, and helper scripts an AI coding agent uses to stage work, execute in batches, validate, review, document, and resume after compaction.

2. **Primary boundary: installable skill bundle vs repo-maintenance tooling**
   - The **installable surface** is centered on `SKILL.md`, `AGENTS.md`, `references/`, and selected `scripts/`.
   - The **repo-only maintenance surface** includes consistency checks, tests, GitHub workflow automation, and local docs that help maintain the bundle itself.

3. **Core orchestration docs**
   - `README.md` describes the operating model and the batch loop.
   - `references/kickoff-prompt-template.md` and `references/plan-template.md` define the human-to-agent handoff.
   - `references/autonomy-guide.md`, `references/review-subagent.md`, and `references/open-ended-guide.md` describe the runtime behavior once the run starts.

4. **Persistent memory / state model**
   - The architecture relies on a layered document stack rather than agent chat memory:
     - plan
     - survival guide
     - learnings
     - execution log
     - optional `.ai-docs/*` durable docs
   - `.ai-docs/manifest.md`, `architecture.md`, `conventions.md`, and `gotchas.md` represent the highest-durability knowledge layer once lessons are stable.

5. **Execution loop**
   - The intended flow is: stage the run, then launch it in a fresh call.
   - During execution, the agent repeatedly performs: implement → validate → review → judge → document → update → push → reread → continue.
   - This is a batch-based loop, with each batch meant to be independently shippable.

6. **Validation subsystem**
   - Validation is script- and project-driven, not hardcoded to one stack.
   - `references/validation-guide.md` and `references/tool-config-examples.md` describe how validation gates are configured or auto-discovered.
   - The repo explicitly supports multiple ecosystems via conventions rather than application code: Node, Python, Go, Rust, and Makefile-based projects.

7. **Review / quality boundaries**
   - Review is treated as a separate quality gate from tests.
   - The repo supports GitHub PR comments by default, with room for custom review APIs and extra checks.
   - The README also describes a “constitution/judge” concept: tests verify correctness, reviews verify plan compliance, and a human-authored legal/behavioral check verifies higher-level intent.

8. **Operational safety scripts**
   - `scripts/preflight.sh` is the startup gatekeeper: it checks environment readiness, git/GitHub access, sleep-prevention conditions, and notification setup.
   - `scripts/notify.sh` handles completion notifications.
   - `scripts/install_doctor.py` inspects installed skill versions and warns when project-local and global installs differ.
   - `scripts/sync_installed_skills.py` is repo maintenance for mirroring the bundle into installed skill locations.

9. **Repository consistency and CI**
   - `scripts/check_repo_consistency.py` enforces that the bundle stays coherent across docs and installable artifacts.
   - `.github/workflows/repo-consistency.yml` automates that check in CI.
   - `tests/test_install_doctor.py` gives the repo at least one executable verification path for the install-doctor behavior.

10. **Documentation lifecycle**
   - `references/` contains the reusable templates and operating guides that define how the skill is used.
   - `docs/plans/` and `docs/elves/` store project-specific planning and learnings content.
   - `docs/plans/v1.7.0-ai-friendly-docs.md` suggests this repo is also used to evolve its own documentation workflow, not just consume it.

11. **Feedback channels**
   - `.github/ISSUE_TEMPLATE/` captures bug reports, feature requests, and overnight run reports.
   - This creates a feedback loop from real unattended runs back into the skill’s templates, guards, and docs.

12. **Platform packaging**
   - The same skill content is intended to work across Claude Code, Codex, Claude.ai, and other Agent Skills-compatible environments.
   - The repo is therefore organized around a shared instruction set plus thin platform-specific entry points, not around a single runtime binary or server.

13. **Net architecture summary**
   - This is a **documentation-driven orchestration system** with three layers:
     - human-authored planning and policy docs,
     - runtime scripts for preflight/notification/install hygiene,
     - maintenance tooling and CI to keep the bundle consistent.
   - The main data flow is: human plan in repo → staged runtime docs → autonomous batch execution → execution log/learnings → durable `.ai-docs` knowledge → final human review.

Main entry points: [`references/plan-template.md`](https://github.com/aigorahub/elves/blob/main/references/plan-template.md) (Plan template), [`references/autonomy-guide.md`](https://github.com/aigorahub/elves/blob/main/references/autonomy-guide.md) (Autonomy guide), [`.ai-docs/manifest.md`](https://github.com/aigorahub/elves/blob/main/.ai-docs/manifest.md) (Manifest), [`scripts/check_repo_consistency.py`](https://github.com/aigorahub/elves/blob/main/scripts/check_repo_consistency.py) (Consistency check)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bundle["Installable skill"]
  node_skill_md["SKILL<br/>[SKILL.md]"]
  node_agents_md["AGENTS<br/>agent instructions<br/>[AGENTS.md]"]
end

subgraph group_runtime["Run loop"]
  node_readme["README<br/>operating model<br/>[README.md]"]
  node_references_hub["References<br/>template set"]
  node_kickoff["Kickoff prompt<br/>handoff template"]
  node_plan_tpl["Plan template<br/>run plan<br/>[plan-template.md]"]
  node_survival["Survival guide<br/>state template"]
  node_exec_log["Execution log<br/>state template"]
  node_learnings_tpl["Learnings template<br/>state template"]
  node_autonomy["Autonomy guide<br/>runtime guide<br/>[autonomy-guide.md]"]
  node_review["Review subagent<br/>quality gate<br/>[review-subagent.md]"]
  node_validation["Validation guide<br/>validation policy"]
  node_tool_config["Tool configs<br/>ecosystem examples"]
  node_verification["Verification patterns<br/>checks guide"]
  node_preflight["Preflight<br/>startup gate<br/>[preflight.sh]"]
  node_notify["Notify<br/>completion hook<br/>[notify.sh]"]
end

subgraph group_knowledge["Durable knowledge"]
  node_manifest["Manifest<br/>durable knowledge<br/>[manifest.md]"]
  node_architecture["Architecture<br/>durable knowledge<br/>[architecture.md]"]
  node_conventions["Conventions<br/>durable knowledge<br/>[conventions.md]"]
  node_gotchas["Gotchas<br/>durable knowledge<br/>[gotchas.md]"]
end

subgraph group_maintenance["Repo maintenance"]
  node_install_doctor["Install doctor<br/>install hygiene<br/>[install_doctor.py]"]
  node_consistency["Consistency check<br/>repo audit"]
  node_sync_skills["Sync skills<br/>maintenance script"]
  node_ci["CI workflow<br/>automation"]
end

subgraph group_feedback["Feedback loop"]
  node_issues["Issue templates<br/>feedback capture<br/>[bug_report.md]"]
end

subgraph group_docs["Project docs"]
  node_docs_plans["Plans doc<br/>project docs"]
  node_docs_learnings["Learnings doc<br/>project docs<br/>[learnings.md]"]
end

node_readme -->|"defines"| node_kickoff
node_readme -->|"uses"| node_plan_tpl
node_readme -->|"explains"| node_autonomy
node_skill_md -->|"paired with"| node_agents_md
node_kickoff -->|"creates"| node_plan_tpl
node_plan_tpl -->|"tracks"| node_survival
node_plan_tpl -->|"records"| node_exec_log
node_plan_tpl -->|"captures"| node_learnings_tpl
node_autonomy -->|"starts with"| node_preflight
node_autonomy -->|"gates on"| node_validation
node_autonomy -->|"separates"| node_review
node_validation -->|"discovers"| node_tool_config
node_validation -->|"supports"| node_verification
node_preflight -->|"configures"| node_notify
node_consistency -->|"enforced by"| node_ci
node_install_doctor -->|"compares"| node_sync_skills
node_consistency -->|"checks"| node_skill_md
node_consistency -->|"checks"| node_references_hub
node_manifest -->|"indexes"| node_architecture
node_manifest -->|"indexes"| node_conventions
node_manifest -->|"indexes"| node_gotchas
node_docs_plans -->|"feeds"| node_docs_learnings
node_issues -->|"reports"| node_docs_learnings
node_issues -->|"surfaces"| node_consistency
node_exec_log -->|"promotes"| node_docs_learnings
node_docs_learnings -->|"stabilizes"| node_manifest

click node_readme "https://github.com/aigorahub/elves/blob/main/README.md"
click node_skill_md "https://github.com/aigorahub/elves/blob/main/SKILL.md"
click node_agents_md "https://github.com/aigorahub/elves/blob/main/AGENTS.md"
click node_kickoff "https://github.com/aigorahub/elves/blob/main/references/kickoff-prompt-template.md"
click node_plan_tpl "https://github.com/aigorahub/elves/blob/main/references/plan-template.md"
click node_survival "https://github.com/aigorahub/elves/blob/main/references/survival-guide-template.md"
click node_exec_log "https://github.com/aigorahub/elves/blob/main/references/execution-log-template.md"
click node_learnings_tpl "https://github.com/aigorahub/elves/blob/main/references/learnings-template.md"
click node_autonomy "https://github.com/aigorahub/elves/blob/main/references/autonomy-guide.md"
click node_review "https://github.com/aigorahub/elves/blob/main/references/review-subagent.md"
click node_validation "https://github.com/aigorahub/elves/blob/main/references/validation-guide.md"
click node_tool_config "https://github.com/aigorahub/elves/blob/main/references/tool-config-examples.md"
click node_verification "https://github.com/aigorahub/elves/blob/main/references/verification-patterns.md"
click node_manifest "https://github.com/aigorahub/elves/blob/main/.ai-docs/manifest.md"
click node_architecture "https://github.com/aigorahub/elves/blob/main/.ai-docs/architecture.md"
click node_conventions "https://github.com/aigorahub/elves/blob/main/.ai-docs/conventions.md"
click node_gotchas "https://github.com/aigorahub/elves/blob/main/.ai-docs/gotchas.md"
click node_install_doctor "https://github.com/aigorahub/elves/blob/main/scripts/install_doctor.py"
click node_preflight "https://github.com/aigorahub/elves/blob/main/scripts/preflight.sh"
click node_notify "https://github.com/aigorahub/elves/blob/main/scripts/notify.sh"
click node_consistency "https://github.com/aigorahub/elves/blob/main/scripts/check_repo_consistency.py"
click node_sync_skills "https://github.com/aigorahub/elves/blob/main/scripts/sync_installed_skills.py"
click node_ci "https://github.com/aigorahub/elves/blob/main/.github/workflows/repo-consistency.yml"
click node_issues "https://github.com/aigorahub/elves/blob/main/.github/ISSUE_TEMPLATE/bug_report.md"
click node_docs_plans "https://github.com/aigorahub/elves/blob/main/docs/plans/v1.7.0-ai-friendly-docs.md"
click node_docs_learnings "https://github.com/aigorahub/elves/blob/main/docs/elves/learnings.md"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_skill_md,node_agents_md toneBlue
class node_readme,node_references_hub,node_kickoff,node_plan_tpl,node_survival,node_exec_log,node_learnings_tpl,node_autonomy,node_review,node_validation,node_tool_config,node_verification,node_preflight,node_notify toneAmber
class node_manifest,node_architecture,node_conventions,node_gotchas toneMint
class node_install_doctor,node_consistency,node_sync_skills,node_ci toneRose
class node_issues toneIndigo
class node_docs_plans,node_docs_learnings toneTeal
```

## Components

### Installable skill

Portable instruction surface used by supported agent environments.

- [SKILL](https://github.com/aigorahub/elves/blob/main/SKILL.md): skill entry · Primary installable skill definition for supported agent environments. · `SKILL.md`
- [AGENTS](https://github.com/aigorahub/elves/blob/main/AGENTS.md): agent instructions · Companion instructions for agent behavior and repository usage. · `AGENTS.md`

### Run loop

Handoff, guidance, validation, and execution-state docs for autonomous sessions.

- [README](https://github.com/aigorahub/elves/blob/main/README.md): operating model · Top-level description of the batch-based autonomous workflow and repo purpose. · `README.md`
- **References**: template set · Reusable prompts, guides, and templates that define the runtime operating model.
- [Kickoff prompt](https://github.com/aigorahub/elves/blob/main/references/kickoff-prompt-template.md): handoff template · Template for staging a new autonomous run before execution begins. · `references/kickoff-prompt-template.md`
- [Plan template](https://github.com/aigorahub/elves/blob/main/references/plan-template.md): run plan · Structured plan format that drives execution batches and checkpoints. · `references/plan-template.md`
- [Survival guide](https://github.com/aigorahub/elves/blob/main/references/survival-guide-template.md): state template · Working-state template used to preserve context across compaction. · `references/survival-guide-template.md`
- [Execution log](https://github.com/aigorahub/elves/blob/main/references/execution-log-template.md): state template · Template for recording batch progress, decisions, and results. · `references/execution-log-template.md`
- [Learnings template](https://github.com/aigorahub/elves/blob/main/references/learnings-template.md): state template · Template for capturing reusable discoveries during a run. · `references/learnings-template.md`
- [Autonomy guide](https://github.com/aigorahub/elves/blob/main/references/autonomy-guide.md): runtime guide · Describes the long-running agent loop and batch execution behavior. · `references/autonomy-guide.md`
- [Review subagent](https://github.com/aigorahub/elves/blob/main/references/review-subagent.md): quality gate · Guidance for separate review and compliance judgment during a run. · `references/review-subagent.md`
- [Validation guide](https://github.com/aigorahub/elves/blob/main/references/validation-guide.md): validation policy · Configures project-driven validation gates and tool discovery. · `references/validation-guide.md`
- [Tool configs](https://github.com/aigorahub/elves/blob/main/references/tool-config-examples.md): ecosystem examples · Examples for validation conventions across supported project ecosystems. · `references/tool-config-examples.md`
- [Verification patterns](https://github.com/aigorahub/elves/blob/main/references/verification-patterns.md): checks guide · Reusable patterns for tests, review checks, and run verification. · `references/verification-patterns.md`
- [Preflight](https://github.com/aigorahub/elves/blob/main/scripts/preflight.sh): startup gate · Checks readiness before a run: environment, access, sleep prevention, notifications. · `scripts/preflight.sh`
- [Notify](https://github.com/aigorahub/elves/blob/main/scripts/notify.sh): completion hook · Sends completion notifications after a run or batch finishes. · `scripts/notify.sh`

### Durable knowledge

Persistent repo memory that captures stable architecture, conventions, and lessons.

- [Manifest](https://github.com/aigorahub/elves/blob/main/.ai-docs/manifest.md): durable knowledge · Highest-durability doc index for stable project knowledge. · `.ai-docs/manifest.md`
- [Architecture](https://github.com/aigorahub/elves/blob/main/.ai-docs/architecture.md): durable knowledge · Stable architectural notes for how the skill bundle is organized. · `.ai-docs/architecture.md`
- [Conventions](https://github.com/aigorahub/elves/blob/main/.ai-docs/conventions.md): durable knowledge · Recorded repository and operational conventions that should persist. · `.ai-docs/conventions.md`
- [Gotchas](https://github.com/aigorahub/elves/blob/main/.ai-docs/gotchas.md): durable knowledge · Known pitfalls and edge cases learned from real usage. · `.ai-docs/gotchas.md`

### Repo maintenance

Checks, install hygiene, and CI that keep the bundle coherent.

- [Install doctor](https://github.com/aigorahub/elves/blob/main/scripts/install_doctor.py): install hygiene · Checks installed skill versions and warns about drift between locations. · `scripts/install_doctor.py`
- [Consistency check](https://github.com/aigorahub/elves/blob/main/scripts/check_repo_consistency.py): repo audit · Enforces coherence between docs, installable artifacts, and bundle layout. · `scripts/check_repo_consistency.py`
- [Sync skills](https://github.com/aigorahub/elves/blob/main/scripts/sync_installed_skills.py): maintenance script · Mirrors the bundle into installed skill locations for local and global installs. · `scripts/sync_installed_skills.py`
- [CI workflow](https://github.com/aigorahub/elves/blob/main/.github/workflows/repo-consistency.yml): automation · Runs repository consistency checks in GitHub Actions. · `.github/workflows/repo-consistency.yml`

### Feedback loop

Issue templates and reports that feed real run experience back into the repo.

- [Issue templates](https://github.com/aigorahub/elves/blob/main/.github/ISSUE_TEMPLATE/bug_report.md): feedback capture · Bug, feature, and overnight-run reports that feed operational feedback back into the repo. · `.github/ISSUE_TEMPLATE/bug_report.md`

### Project docs

Planning and documentation used to evolve the repo’s own operating model.

- [Plans doc](https://github.com/aigorahub/elves/blob/main/docs/plans/v1.7.0-ai-friendly-docs.md): project docs · Project-specific planning and evolution notes for the skill and its docs workflow. · `docs/plans/v1.7.0-ai-friendly-docs.md`
- [Learnings doc](https://github.com/aigorahub/elves/blob/main/docs/elves/learnings.md): project docs · Collected learnings from real runs and repository usage. · `docs/elves/learnings.md`

## Connections

- README → Kickoff prompt: defines · README points to the staging handoff and operating model.
- README → Plan template: uses · The plan template structures batch execution.
- README → Autonomy guide: explains · The guide describes the autonomous loop.
- SKILL → AGENTS: paired with · Installable skill surface is split across the main skill and agent instructions.
- Kickoff prompt → Plan template: creates · Kickoff handoff instantiates a run plan.
- Plan template → Survival guide: tracks · Plan execution depends on a preserved working-state summary.
- Plan template → Execution log: records · Execution log captures each batch and checkpoint.
- Plan template → Learnings template: captures · Learnings are extracted as reusable knowledge.
- Autonomy guide → Preflight: starts with · Runs begin with readiness checks.
- Autonomy guide → Validation guide: gates on · Validation is a first-class step in the run loop.
- Autonomy guide → Review subagent: separates · Review is treated as distinct from test validation.
- Validation guide → Tool configs: discovers · Validation supports project-specific tool conventions.
- Validation guide → Verification patterns: supports · Validation relies on reusable verification patterns.
- Preflight → Notify: configures · Startup gate verifies notification setup.
- Consistency check → CI workflow: enforced by · Repo consistency is automated in GitHub Actions.
- Install doctor → Sync skills: compares · Install hygiene checks pair with skill mirroring.
- Consistency check → SKILL: checks · Consistency audits the installable bundle surface.
- Consistency check → References: checks · Consistency also spans reference docs and templates.
- Manifest → Architecture: indexes · Manifest organizes durable knowledge layers.
- Manifest → Conventions: indexes · Manifest includes stable conventions.
- Manifest → Gotchas: indexes · Manifest includes known pitfalls.
- Plans doc → Learnings doc: feeds · Planning and learnings evolve together as documentation.
- Issue templates → Learnings doc: reports · Issue templates capture field feedback that can become learnings.
- Issue templates → Consistency check: surfaces · Operational reports can expose bundle drift or inconsistency.
- Execution log → Learnings doc: promotes · Stable lessons move from run logs into persistent learnings.
- Learnings doc → Manifest: stabilizes · Durable learnings are promoted into the knowledge index.
