extra pt2

This commit is contained in:
2026-03-09 17:34:14 +00:00
parent 457fb2068b
commit e0c4c2ed7b
14 changed files with 310 additions and 21 deletions

View File

@@ -0,0 +1,36 @@
# Conventions
## File Organization
```
~/.config/opencode/
├── opencode.jsonc # Main config (default agent, plugins, permissions)
├── AGENTS.md # Cross-tool instructions (single source of truth)
├── CLAUDE.md -> AGENTS.md # Symlink for Claude
├── .cursorrules -> AGENTS.md # Symlink for Cursor
├── agents/ # Agent definitions
│ ├── lead.md
│ ├── coder.md
│ ├── reviewer.md
│ └── ...
├── skills/ # Reusable skill modules
│ └── doc-coverage/
└── .memory/ # Persistent memory
```
## Naming Conventions
- Agent files: `{role}.md` (e.g., `coder.md`, `reviewer.md`)
- Plan files: `{feature}.md` (e.g., `memory-restructure.md`)
- Research files: `{topic}.md` (e.g., `micode-memory-system.md`)
- Gate files: `{feature}.md` (e.g., `auth-flow.md`)
## Memory Structure
See [Memory Structure](../manifest.yaml) for the canonical structure.
## Cross-Tool Instructions
- `AGENTS.md` is the single source of truth
- All other instruction files are symlinks to it
- Never edit symlinked files directly

View File

@@ -0,0 +1,35 @@
# Domain Concepts
## Agent Roles
| Role | Responsibility |
|------|----------------|
| Lead | Primary orchestrator — decomposes work, delegates, synthesizes |
| Coder | Implementation-focused coding |
| Reviewer | Code quality, correctness, security review |
| Tester | Functional and adversarial testing |
| Explorer | Fast codebase mapping and discovery |
| Researcher | Deep technical investigation |
| Librarian | Documentation coverage and accuracy |
| Critic | Pre-implementation gate and blocker resolution |
| SME | Domain-specific consultation |
| Designer | UI/UX interaction and visual guidance |
## Memory Categories
| Category | Purpose | Location |
|----------|---------|----------|
| Knowledge | Persistent project understanding | `.memory/knowledge/` |
| Decisions | Architecture Decision Records | `.memory/decisions.md` |
| Plans | Active implementation plans | `.memory/plans/` |
| Research | Technical investigations | `.memory/research/` |
| Gates | Quality gate records | `.memory/gates/` |
| Sessions | Session continuity | `.memory/sessions/` |
## Quality Pipeline Flow
Standard flow: `explorer/researcher → coder → reviewer → tester → librarian`
Exceptions:
- Tier 3: skips tester
- Tier 1: adds security reviewer and adversarial tester

View File

@@ -0,0 +1,40 @@
# Project Overview
This is the OpenCode agentic configuration for a multi-agent coding workflow. It defines agent roles, permissions, quality pipelines, and project memory conventions used across all projects that load this config.
- **Config root:** `~/.config/opencode/`
- **Config file:** `opencode.jsonc` — defines default agent, plugins, global permissions, and MCP servers.
- **Agent definitions:** `agents/*.md` — one file per agent with YAML frontmatter (model, permissions, temperature) and markdown instructions.
- **Memory system:** `.memory/` — persistent project knowledge, decisions, plans, and research in markdown.
- **Cross-tool instruction files:** `AGENTS.md` is the single real instruction file; `CLAUDE.md`, `.cursorrules`, and `.github/copilot-instructions.md` are symlinks to it.
## Agent Architecture
10 agents with distinct roles, models, and permission profiles. See [Agent Roster in AGENTS.md](../../AGENTS.md#agent-roster) for the full table.
### Permission Model
- **Full edit access:** `lead`, `coder`, `librarian`.
- **Memory-only edit access:** `reviewer`, `tester`, `explorer`, `researcher`, `critic`, `sme`, `designer` — these agents have `permission.edit: allow` but are instructed to keep code/source edits read-only. Their edit permission exists solely to support `.memory/*` writes for recording duties (verdicts, discoveries, research, guidance, design decisions).
- **No edit access:** none (all agents can write `.memory/*`).
See [Decision: Agent Memory Write Access](../decisions.md#agent-memory-write-access) for rationale and guardrails.
### Memory Write Guardrails
Agents with memory-only edit access are constrained by instruction-level guardrails (not path-scoped config, which OpenCode does not support):
1. Each agent's instructions explicitly state: "`.memory/*` writes are allowed for [specific duty]; code/source edits remain read-only."
2. Each agent's instructions list tool restrictions (e.g., "Disallowed: non-memory file edits").
3. The `permission.edit: allow` fallback is necessary because OpenCode's `permission.edit` does not support path-scoped allow/deny syntax.
## Quality Pipeline
Tiered pipeline (Tier 1/2/3) defined in `agents/lead.md`. Standard flow: `explorer/researcher → coder → reviewer → tester → librarian`.
## Documentation Skill Conventions
- `skills/doc-coverage/SKILL.md` section `### 3. Instruction File` validates one canonical instruction file (`AGENTS.md`) plus symlink correctness for `CLAUDE.md`, `.cursorrules`, and `.github/copilot-instructions.md`, rather than treating all four as independently edited files.
- The checklist explicitly flags duplication of `.memory/` tracking content (plans/research) inside instruction files as an anti-pattern.
See [Cross-Tool Instruction Files](../../AGENTS.md#cross-tool-instruction-files) and [Doc coverage checklist section 3](../skills/doc-coverage/SKILL.md#3-instruction-file).

View File

@@ -0,0 +1,21 @@
# Error Handling Patterns
## Agent-Level Error Handling
Agents follow the retry circuit breaker pattern defined in `agents/lead.md`:
- After 3 coder rejections on the same task: revisit design, simplify, or consult SME
- After 5 total failures: escalate to user (Tier-3 escalation)
## Memory Write Errors
Agents with memory-only edit access should:
1. Write to `.memory/*` files for their recording duties
2. If write fails, report to lead for escalation
3. Never attempt to modify non-memory files as a workaround
## Quality Gate Failures
- Reviewer `CHANGES-REQUESTED` is a hard block — do not advance to tester
- Reviewer `REJECTED` requires redesign — do not retry same approach
- Tester `PARTIAL` is not a pass — either fix blocker or escalate to user

View File

@@ -0,0 +1,27 @@
# Logging Patterns
## Agent Output Standards
Subagents must return actionable results, not status recaps:
| Agent | Expected Output |
|-------|-----------------|
| Explorer | File maps, edit points, dependency chains |
| Researcher | Specific findings, code patterns, API details |
| Tester | Test results with pass/fail counts and specific failures |
| Reviewer | Structured verdict with findings and resolution status |
## Recording Discipline
Memory files preserve *knowledge*, not *activity logs*:
- ✅ Record: outcomes, decisions, discoveries, patterns
- ❌ Don't record: phase transitions, status changes, ceremony checkpoints
## Verdict Tracking
All reviewer/tester findings must be tracked to resolution:
- Status flow: `OPEN → ASSIGNED → RESOLVED | WONTFIX`
- Findings must not be silently dropped
- Include unresolved findings in coder re-dispatch

View File

@@ -0,0 +1,25 @@
# Testing Patterns
## Verification Tiers
| Tier | Scope | Pipeline |
|------|-------|----------|
| Tier 1 | New features, security-sensitive, multi-file refactors | coder → reviewer:correctness → reviewer:security → tester:standard → tester:adversarial |
| Tier 2 | Moderate changes, UI updates, bug fixes | coder → reviewer:correctness → tester:standard |
| Tier 3 | Single-file fixes, config tweaks, copy changes | coder → reviewer:correctness |
## Functional Verification Requirements
Static analysis is NOT verification. Every feature must be functionally verified:
- **API endpoints**: Real HTTP requests with response verification
- **Frontend**: Browser-based or test-suite verification
- **Full-stack**: End-to-end UI → API → DB → response cycle
- **Bug fixes**: Reproduce bug, verify it no longer occurs
## What Does NOT Count as Verification
- ❌ Type checks (`tsc`, `bun run check`)
- ❌ Linting (`eslint`, `ruff`)
- ❌ Build succeeding
- ❌ Reading code and concluding "this looks correct"

View File

@@ -0,0 +1,22 @@
# Tech Stack
## Core Technologies
| Component | Technology | Notes |
|-----------|------------|-------|
| Runtime | OpenCode CLI | Agentic coding tool |
| Config format | JSONC | `opencode.jsonc` with comments |
| Agent definitions | Markdown + YAML frontmatter | `agents/*.md` |
| Memory system | Markdown + YAML | `.memory/` directory |
## MCP Servers
| Server | Purpose | Endpoint |
|--------|---------|----------|
| Context7 | Remote documentation lookup | `https://mcp.context7.com/mcp` |
| GitHub Grep | Remote code search across public repos | `https://mcp.grep.app` |
| Playwright | Local headless Chromium for UI testing | Local |
## Model Assignments
See [Agent Roster](../../AGENTS.md#agent-roster) for model assignments per agent role.