docs: add PRD docs and move DESIGN.md to docs/

This commit is contained in:
sam committed 2026-07-21 17:30:43 +10:00
1 parent 865a2bab9f
commit 5cb4f32a8d
3 files changed
+800

No files matched your search

View File
File renamed without changes.
+399
View File
@@ -0,0 +1,399 @@
# archie-core Skills System — PRD
**Author:** Archie (Hermes agent)
**Date:** 2026-07-18
**Status:** Draft
---
## What archie-core is
arcie-core is an LLM coding agent that responds to issues, queries, and commands on connected interfaces. The current MVP runs on GitHub: it receives issue assignments, analyses scope and requirements, implements changes in isolated worktrees, runs quality gates, and opens pull requests.
The skills system extends this with reusable playbooks that tell archie-core **how** to work on any given project.
---
## 1. The workflow file (`archie.yaml`)
Every project can ship an `archie.yaml` that defines how archie-core should behave when working on that codebase. Without one, archie-core uses sensible defaults (read files, run bash, open PRs). With one, it knows the exact gates to pass, tools available, commit format, and which skills are relevant.
### 1.1 Discovery
```
.archie.yaml (root of repo — highest precedence)
archie.yaml (repo root)
.archie/archie.yaml (subdirectory, one level deep)
```
### 1.2 Schema
```yaml
# archie.yaml
version: "1"
# Project identity
project:
name: my-go-service
language: go
repo: github.com/sam/my-go-service
# How archie-core connects to this project
connection:
interfaces:
- github # respond to assigned issues
- linear # respond to labelled tickets
- webhook # respond to HTTP POSTs
github:
repo: sam/my-go-service
issue_labels:
ready: "archie:ready" # issues with this label get claimed
claimed: "archie:claimed" # archie sets this when working
done: "archie:done" # archie sets this after PR
pr:
base: main
draft: false
# Skills — playbooks archie-core loads to know how to work
skills:
paths:
- .archie/skills/ # project-local skills
- ~/.archie/skills/ # per-user skills
remotes:
- github.com/sam/archie-skills@v1 # shared skill library
# Sandbox — what's available in the container
sandbox:
image: ghcr.io/sam/archie-sandbox:latest
tools:
- go
- golangci-lint
- gofumpt
- task
- gh
- docker
env:
GOFLAGS: "-mod=readonly"
# Gates — archie-core must pass these before committing
gates:
test:
run: go test -race -count=1 ./...
timeout: 300
lint:
run: golangci-lint run ./...
timeout: 120
format:
run: gofumpt -w . && git diff --exit-code
deadcode:
run: task deadcode
optional: true
# Quality pipeline — which gates run when
quality:
pre_commit: [test, lint, format]
pre_push: [deadcode]
# Commit conventions
commit:
format: conventional
signoff: false
# Branch conventions
branch:
format: "{type}/cat-{number}-{kebab-description}"
types:
feat: "Feature work"
fix: "Bug fixes"
test: "Test additions"
chore: "Maintenance"
refactor: "Code restructuring"
docs: "Documentation"
```
---
## 2. Skills (playbooks)
Skills are Markdown documents that tell archie-core **how** to perform specific tasks. They follow the [agentskills.io](https://agentskills.io/specification) format, making them portable across LLM coding agents (Claude Code, Codex, Tau, Pi, archie-core).
### 2.1 Format
```
go-testing/
├── SKILL.md # Required: frontmatter + instructions
├── references/ # Optional: supplementary docs
│ └── coverage.md
├── scripts/ # Optional: executable helpers
│ └── bench.sh
└── assets/ # Optional: templates
└── test.vscode.code-snippets
```
### 2.2 SKILL.md
```markdown
---
name: go-quality-gate
description: >
Run the full Go quality pipeline for Tau projects:
gofumpt, go fix, golangci-lint, go test -race, and task deadcode.
Use before any commit in a Go project.
version: 1.0.0
metadata:
archie:
# Which gates this skill covers
gates: [test, lint, format, deadcode]
# Required sandbox tools
tools: [go, golangci-lint, gofumpt, task]
# Preferred engine (if multiple available)
engine: any
# Max spend for this skill
budget_usd: 2.00
---
# Go Quality Gate
## When to use
Before committing any Go change. After implementing a feature or fix.
## Procedure
Run in this exact order. If any step fails, fix the issue before continuing.
1. `gofumpt -w .`
2. `go fix ./...`
3. `golangci-lint run ./...`
4. `go test -race -count=1 ./...`
5. `task deadcode`
## Verification
All five steps must exit 0. If `task deadcode` fails on unrelated packages,
scope it to only changed packages: `golangci-lint run --tests=false --enable-only=unused,staticcheck ./changed/pkg/...`
## Common failures
- `golangci-lint`: unused function — remove it or add `//nolint:unused` comment
- `go test -race`: data race — protect with mutex or channel
- `task deadcode`: pre-existing dead code in unrelated package — scope to changed packages
```
### 2.3 Skill metadata (arcie-specific)
Skills carry archie-specific metadata under `metadata.archie`:
| Field | Purpose |
|---|---|
| `gates` | Which gates from `archie.yaml` this skill covers |
| `tools` | Sandbox tools this skill needs |
| `engine` | Preferred execution engine (`claude`, `tau`, `codex`, `pi`, `raw`, `any`) |
| `model` | Preferred model for this skill |
| `budget_usd` | Max spend ceiling |
| `timeout` | Max seconds |
| `worktree` | Whether to create isolated worktree |
### 2.4 Progressive disclosure
Following the skills.sh model to keep context lean:
1. **Advertise** (~100 tokens per skill): `name` + `description` loaded at startup
2. **Activate** (<5000 tokens): Full SKILL.md body loaded when skill is relevant
3. **Resources** (as needed): References, scripts, assets loaded on demand
---
## 3. How archie-core processes an issue
This is the core loop. When an issue lands with the configured label:
### 3.1 Analyse
1. Read issue title, body, labels, comments
2. Load relevant skills from the project's `archie.yaml`
3. Determine scope: which packages, files, and gates are in play
4. Determine branch type (`feat/`, `fix/`, `test/`, etc.) from issue labels or conventional commit prefix
### 3.2 Claim
1. Set issue label to `archie:claimed`
2. Comment: "Archie claimed this. Branch: `<branch>`"
3. Create isolated worktree from `main`
### 3.3 Implement
1. Load full skill bodies for each relevant skill
2. Read project source and tests in the affected area
3. Implement changes, writing tests first where applicable
4. Run targeted tests iteratively
### 3.4 Gate
1. Run all gates from the quality pipeline in order
2. Fix any failures, re-running from the failing gate
3. Audit diff for secrets, unrelated changes, attribution
### 3.5 Deliver
1. Commit with conventional format: `feat(scope): description`
2. Push branch
3. Open PR to `main` with:
- Summary of changes
- Acceptance criteria addressed
- Gate results
- Link back to source issue/Linear ticket
4. Set issue label to `archie:done`
5. Comment with PR URL
### 3.6 On failure
If any gate fails irrecoverably:
1. Leave issue as `archie:claimed`
2. Comment with exact blocker, failed command, and worktree path
3. Preserve worktree for inspection
4. Do not open a broken PR
---
## 4. Engine abstraction
arcie-core can delegate implementation to different LLM engines. The workflow file declares preference order; archie-core resolves the first available engine at runtime.
```yaml
engines:
- type: claude # Claude Code CLI — full agent loop
model: sonnet
budget_usd: 5.00
- type: tau # Tau — Sam's native Go agent
model: gpt-4o
budget_usd: 2.00
- type: codex # OpenAI Codex CLI
model: gpt-5.1-codex-max
- type: raw # Direct LLM — no agent loop, single prompt
model: gpt-4o-mini
```
Each engine provides the same interface:
```
Engine:
- Run(prompt, tools, budget, timeout) -> Result
- Skills() -> []SkillName
- Capabilities() -> {streaming, reasoning, vision, agentic}
```
For skills that need a specific engine, the skill metadata overrides:
```yaml
metadata:
archie:
engine: claude # this skill only works with Claude
```
---
## 5. Skills in practice
### 5.1 Project-specific skill
```yaml
# .archie/skills/tau-quality-gate/SKILL.md
---
name: tau-quality-gate
description: >
Full Tau quality pipeline: gofumpt, go fix, golangci-lint,
go test -race, task deadcode. Use for all Tau repo changes.
metadata:
archie:
gates: [test, lint, format, deadcode]
tools: [go, golangci-lint, gofumpt, task]
---
```
### 5.2 Shared skill library
```yaml
# archie.yaml
skills:
remotes:
- github.com/sam/archie-skills@v1
```
Skills from the shared library are available alongside project-local skills. The agent loads them on demand when an issue references relevant concepts.
### 5.3 Skill that wraps an external tool
```yaml
---
name: trivy-scan
description: >
Scan container images and filesystems for vulnerabilities using Trivy.
Use when asked about security scanning, CVEs, or container hardening.
metadata:
archie:
tools: [docker, trivy]
engine: any
---
## Procedure
1. `trivy image --severity HIGH,CRITICAL <image>`
2. If findings exist, report each CVE with package, version, and fixed version
3. If no findings, report clean
```
---
## 6. Comparison: archie-core vs existing systems
| | archie-core | Claude Code | Codex CLI | GitHub Actions | Hermes Agent |
|---|---|---|---|---|---|
| **How it receives work** | GitHub issue assignment, Linear label, webhook | Chat, slash commands | Chat, slash commands | YAML triggers (push, PR, schedule) | Chat, cron, webhooks |
| **What it does** | Analyse → implement → gate → PR | Analyse → implement → gate → PR | Analyse → implement → gate → PR | Run arbitrary shell commands | Analyse → implement → gate → PR |
| **Skills** | SKILL.md (agentskills.io) | SKILL.md (native) | SKILL.md (agentskills.io) | Composite actions | SKILL.md (native) |
| **Gates** | Named checkpoints in archie.yaml | Ad-hoc (CLAUDE.md + lint) | Ad-hoc | Steps in jobs | Skills with gates |
| **Engine pluggable** | Yes (claude, tau, codex, pi, raw) | No (fixed to Claude) | No (fixed to Codex) | No (fixed to GitHub) | Yes (provider config) |
| **Worktree isolation** | Yes | Yes (`--worktree`) | No | No (ephemeral runner) | No |
| **Blueprint/cron** | Export to Hermes | No | No | Schedule trigger | Native |
| **Where it runs** | Docker sandbox | Host | Host or sandbox | GitHub runner | Host, Docker, Modal, SSH |
---
## 7. Implementation phases
### Phase 1: Workflow file and gates (current MVP)
- `archie.yaml` parser
- Gate runner executing shell commands and checking exit codes
- Skill discovery from project and user paths
- GitHub interface: claim issues, create worktrees, open PRs
### Phase 2: Skills
- SKILL.md progressive disclosure (advertise → activate → resources)
- archie-specific metadata parsing
- Skill chaining: skills that depend on other skills
- `archie skills list/install` CLI
### Phase 3: Engine abstraction
- Engine interface definition
- Claude Code adapter
- Raw LLM adapter
- Engine fallback chain
- Per-skill engine preferences
### Phase 4: Advanced features
- Gate overrides per skill
- Skill templates for project scaffolding (`archie init --skill go-service`)
- Remote skill libraries (git repos as skill sources)
- Blueprint export to Hermes cron
### Phase 5: Additional interfaces
- Linear webhook integration
- Generic webhook interface for arbitrary sources
- CLI command interface (`archie run <command>`)
---
## 8. Open questions
1. **Claim protocol:** Single-claim (arcie takes one issue at a time) or queue-based (claims N issues, works through them sequentially)?
2. **Concurrent worktrees:** Allow multiple archie-core instances working on different issues simultaneously?
3. **PR merging:** Should archie-core ever auto-merge, or always require human review?
4. **Skill registry:** Self-host on git.catlow.cloud, use agentskills.io, or both?
5. **Engine budget enforcement:** Per-issue, per-skill, or monthly cap?
6. **Sandbox building:** Pre-built Docker images vs. project-defined Dockerfiles vs. Nix shells?
+401
View File
@@ -0,0 +1,401 @@
# archie-core Workflows & Skills — Product Requirements Document
**Author:** Archie (Hermes agent)
**Date:** 2026-07-18
**Status:** Draft
---
## Overview
This PRD defines a workflow and skills system for archie-core. Workflow files declare gates, tool availability, execution engines, and skill references. Skills are reusable playbook documents the agent loads on demand. Together they enable any project to define how agents work within their sandbox, and any execution engine (Claude, Codex, Tau, Pi, raw LLM) to be the runtime.
---
## 1. Workflow Files (`archie.yaml`)
### 1.1 Discovery
A project declares its workflow in `archie.yaml` at the project root. archie-core discovers it the same way Task (Taskfile) and devcontainers do:
```
.archie.yaml (root of repo — highest precedence)
archie.yaml (repo root)
.archie/archie.yaml (subdirectory, one level deep)
```
If no file is found, archie-core uses built-in defaults (read, write, bash).
### 1.2 Schema
```yaml
# archie.yaml — complete schema
version: "1"
# Project identity
project:
name: my-go-service
language: go
# Available skills (directories or individual files)
skills:
paths:
- .archie/skills/ # project-local skills
- ~/.archie/skills/ # per-user skills
- github.com/org/shared-skills@v1 # remote skill repo
skills:
- go-testing # named skill from any path
- security-audit
# Execution engines in preference order
engines:
- type: claude # Claude Code CLI
model: sonnet
- type: tau # Tau (native agent)
model: gpt-4o
- type: codex # OpenAI Codex
- type: pi # Pi agent harness
- type: raw # Direct LLM without agent wrapper
# Sandbox definition (what the Docker container provides)
sandbox:
image: ghcr.io/samcharles93/archie-sandbox:latest
tools:
- go
- golangci-lint
- gofumpt
- task
- gh
- docker
mounts:
- source: /var/run/docker.sock
target: /var/run/docker.sock
env:
GOFLAGS: "-mod=readonly"
CGO_ENABLED: "0"
# Gates — ordered checkpoints that must pass
gates:
test:
run: go test -race -count=1 ./...
timeout: 300
description: "All tests must pass"
lint:
run: golangci-lint run ./...
timeout: 120
description: "Zero lint issues"
format:
run: gofumpt -w . && git diff --exit-code
description: "No formatting drift"
vet:
run: go vet ./...
description: "No vet warnings"
deadcode:
run: task deadcode
optional: true # non-blocking gate
description: "Dead code check (advisory)"
# Quality pipeline — ordered sequence of gate groups
quality:
pre_commit:
- test
- lint
- format
- vet
pre_push:
- deadcode
# Commit conventions
commit:
format: conventional # conventional commits
signoff: false
template: "feat({scope}): {description}"
# PR conventions
pr:
template: .github/PULL_REQUEST_TEMPLATE.md
checks:
- test
- lint
# Project-specific commands (what `archie run <name>` executes)
commands:
build:
run: go build -o bin/app ./cmd/server
description: "Build the binary"
serve:
run: go run ./cmd/server
description: "Start dev server"
test:
run: go test ./...
description: "Run all tests"
lint:
run: golangci-lint run ./...
description: "Run linter"
all:
run:
- gofumpt -w .
- go fix ./...
- golangci-lint run ./...
- go test -race ./...
- task deadcode
description: "Full quality pipeline"
```
### 1.3 Design decisions (with rationale)
| Decision | Rationale |
|---|---|
| YAML over TOML/JSON | Already dominant in CI (GitHub Actions, GitLab CI, Taskfile). Human-readable with comments. |
| Single file over multi-file | Task discovery (like `Taskfile.yml`), devcontainer conventions. Avoids directory sprawl. |
| Gates as named checkpoints | GitHub Actions job model. Gates can be composed into quality pipelines, selected individually, or skipped with `--skip`. |
| Engines as ordered preference list | Supports "try Claude first, fall back to Tau, fall back to raw LLM." Each engine declares its own tool surface. |
| Skills as paths + references | Matches devcontainer features (paths resolve to directories) and skills.sh (namespaced references). |
| Commands section for direct invocation | Arnie can `archie run test` without an agent turn. Thin wrapper over the sandbox. |
| Quality pipeline groups gates | Pre-commit vs pre-push vs pre-merge distinction. Some gates are required, some advisory. |
---
## 2. Skills
### 2.1 Format
Skills follow the [agentskills.io](https://agentskills.io/specification) specification:
```
skill-name/
├── SKILL.md # Required: YAML frontmatter + Markdown instructions
├── scripts/ # Optional: executable helpers
├── references/ # Optional: longer docs, checklists
└── assets/ # Optional: templates, configs
```
**SKILL.md frontmatter:**
```yaml
---
name: go-testing
description: >
Run Go tests with race detection, coverage, and benchmark analysis.
Use when asked to test Go code, run the test suite, or check coverage.
version: 1.0.0
metadata:
archie:
gates: [test] # gates this skill requires
tools: [go, golangci-lint] # sandbox tools it needs
engine: any # engine preference (any, claude, tau, raw)
compatibility: Requires Go 1.22+
---
```
### 2.2 Progressive disclosure
Following the skills.sh and Claude Code patterns:
1. **Advertise** (~100 tokens): `name` + `description` loaded at session start
2. **Load** (<5000 tokens recommended): Full SKILL.md body when skill activates
3. **Resources** (as needed): Scripts, references, assets loaded on demand
### 2.3 archie-specific metadata
Skills can carry archie-specific frontmatter under `metadata.archie`:
```yaml
metadata:
archie:
gates: [test, lint] # must-pass gates before skill runs
tools: [go, docker] # sandbox tools required
engine: tau # preferred engine
model: gpt-4o # preferred model
budget_usd: 2.00 # max spend ceiling
timeout: 600 # max seconds
worktree: true # create isolated worktree
```
### 2.4 Skill sources (inspired by devcontainer features + Dagger modules)
```
skills:
paths:
- .archie/skills/ # project-local (committed)
- ~/.archie/skills/ # per-user (personal)
skills:
- go-testing # by name from any path
remotes:
- github.com/samcharles93/archie-skills@v1 # tagged git repo
- https://agentskills.io/registry # community registry
```
---
## 3. Execution Engine Model
### 3.1 Engine abstraction
Each engine provides the same interface. The workflow file declares preference order; archie-core resolves the first available engine at runtime.
```
Engine interface:
- Run(prompt, tools[], budget, timeout) -> Result
- Tools() -> []ToolSchema
- Capabilities() -> {streaming, reasoning, vision, agentic}
```
### 3.2 Supported engines
| Engine | Type | What it provides |
|---|---|---|
| `claude` | Claude Code CLI | Full agent loop, tool use, worktrees, subagents |
| `codex` | OpenAI Codex CLI | Agentic coding with sandbox |
| `tau` | Tau (Sam's agent) | Native Go agent with TUI, event bus |
| `pi` | Pi agent harness | Minimalist coding agent, stdio protocol |
| `raw` | Direct LLM call | Single-turn prompt, no agent loop. For simple scripts. |
### 3.3 Engine selection logic
```yaml
engines:
- type: claude
model: sonnet
budget_usd: 5.00
- type: tau
model: gpt-4o
budget_usd: 2.00
- type: raw
model: gpt-4o-mini
```
arcie-core tries engines in order. If Claude is available and authenticated, it's used. If not, falls to Tau. If Tau isn't built, falls to raw LLM. Each engine declares its budget ceiling.
---
## 4. Additional Features
### 4.1 Worktree isolation (`worktree: true`)
Inspired by Claude Code's `--worktree` flag. When a skill or command sets `worktree: true`, archie-core:
1. Creates an isolated git worktree at `.archie/worktrees/<skill-name>-<timestamp>/`
2. Runs all gates and implementation in that worktree
3. Cleans up on success, preserves on failure for inspection
This prevents concurrent agent sessions from conflicting and enables parallel agent execution.
### 4.2 Skill chaining and composition
Skills can declare dependencies, forming a DAG:
```yaml
---
name: full-ci
description: Complete CI pipeline including security audit
metadata:
archie:
requires: [go-testing, security-audit]
run_sequential: true
---
```
arcie-core resolves the dependency graph and runs skills in order (parallel where possible, respecting `run_sequential`). This is conceptually similar to GitHub Actions `needs` and Taskfile `deps`.
### 4.3 Gate overrides per skill
A skill can override project-level gates:
```yaml
metadata:
archie:
gates:
test:
run: go test -short ./... # override: faster test for this skill
lint: skip # skip lint for this skill
```
Three override modes: `override` (replace command), `skip` (omit gate), `add` (add new gate requirement).
### 4.4 Skill templates (scaffolding)
Skills can carry an `assets/` directory with templates. When archie-core initializes a new project, it can apply skill templates:
```
skill-name/
├── SKILL.md
└── assets/
├── .archie.yaml.tmpl # Template workflow file
├── Taskfile.yml.tmpl # Template task runner
└── .golangci.yml.tmpl # Template linter config
```
`archie init --skill go-service` scaffolds a new project with the go-service skill's templates applied.
### 4.5 Blueprint export (Hermes cron integration)
Following the Hermes Automation Blueprints model, any archie-core workflow can be exported as a Hermes blueprint:
```yaml
metadata:
archie:
blueprint:
schedule: "every 6h"
deliver: telegram
name: "Tau CI monitor"
```
The export produces a `SKILL.md` with `metadata.hermes.blueprint` that Hermes can schedule. The blueprint's prompt is the archie workflow's quality pipeline.
---
## 5. Comparison to Existing Systems
| Feature | archie-core | GitHub Actions | Dagger | Taskfile | devcontainer | Hermes Skills |
|---|---|---|---|---|---|---|
| Language | YAML | YAML | Go/Python/TS | YAML | JSON | Markdown |
| Gates | Named + composable | Steps in jobs | Functions | Tasks | Lifecycle scripts | N/A |
| Engine abstraction | First-class | GitHub only | Dagger Engine | Shell only | None | Provider |
| Skills | agentskills.io spec | Composite actions | Dagger Modules | Includes | Features | SKILL.md |
| Worktree isolation | Built-in | No | Containers | No | Container | No |
| Blueprint export | To Hermes cron | No | No | No | No | Native |
| Multi-engine fallback | Yes (ordered list) | No | No | No | No | Provider config |
| Progressive disclosure | Yes (skill spec) | No | No | No | Feature metadata | Yes |
---
## 6. Implementation Phases
### Phase 1: Core workflow file
- `archie.yaml` parser and schema validation
- Gate runner (test, lint, format, vet)
- `archie run <command>` CLI
- Sandbox Docker integration
### Phase 2: Skills
- SKILL.md discovery and progressive disclosure
- Skill metadata with gate/tool/engine requirements
- `archie skills list/install/search`
### Phase 3: Engine abstraction
- Engine interface definition
- Claude Code adapter
- Raw LLM adapter
- Engine fallback chain
### Phase 4: Advanced features
- Worktree isolation
- Skill chaining (dependency DAG)
- Gate overrides
- Blueprint export
### Phase 5: Ecosystem
- Public skill registry
- `archie init --skill <name>` scaffolding
- Community skill contributions
---
## 7. Open Questions
1. **Skill registry hosting:** Self-hosted on git.catlow.cloud, or use agentskills.io?
2. **Tau integration depth:** Tau as an engine via CLI, or Tau consuming archie.yaml natively?
3. **Hermes integration:** Should archie-core be a Hermes tool, a Hermes skill, or standalone?
4. **Budget enforcement:** Per-skill budget vs. per-workflow budget vs. monthly cap?
5. **Sandbox image building:** Pre-built images vs. Dockerfile in each skill?