2026-03-25 10:58:00 +00:00
# AGENTS.md — Universal Agent Instructions
feat: add Codex extension — agents, skills, rules, config
Parallel to the Claude Code plugin (claude/), core-agent now supports
Codex with full feature parity:
- .codex/config.toml — model, profiles (review/quick/implement/lem),
MCP server, local model providers (Ollama/LM Studio)
- .codex/agents/ — reviewer, migrator, fixer (AX-aware)
- .codex/rules/ — Starlark rules for sandbox control
- .agents/skills/ — 9 skills matching Claude plugin
- AGENTS.md — Codex project instructions (like CLAUDE.md)
Supports --oss mode for local models (LEM via Ollama).
Same binary, two entry points.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:20:59 +00:00
2026-03-25 10:58:00 +00:00
> For all AI agents working on this repository (Codex, Claude, Gemini, etc).
> See also: `llm.txt` for entry points, RFC-025 for design conventions.
feat: add Codex extension — agents, skills, rules, config
Parallel to the Claude Code plugin (claude/), core-agent now supports
Codex with full feature parity:
- .codex/config.toml — model, profiles (review/quick/implement/lem),
MCP server, local model providers (Ollama/LM Studio)
- .codex/agents/ — reviewer, migrator, fixer (AX-aware)
- .codex/rules/ — Starlark rules for sandbox control
- .agents/skills/ — 9 skills matching Claude plugin
- AGENTS.md — Codex project instructions (like CLAUDE.md)
Supports --oss mode for local models (LEM via Ollama).
Same binary, two entry points.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:20:59 +00:00
2026-03-25 10:58:00 +00:00
## Overview
feat: add Codex extension — agents, skills, rules, config
Parallel to the Claude Code plugin (claude/), core-agent now supports
Codex with full feature parity:
- .codex/config.toml — model, profiles (review/quick/implement/lem),
MCP server, local model providers (Ollama/LM Studio)
- .codex/agents/ — reviewer, migrator, fixer (AX-aware)
- .codex/rules/ — Starlark rules for sandbox control
- .agents/skills/ — 9 skills matching Claude plugin
- AGENTS.md — Codex project instructions (like CLAUDE.md)
Supports --oss mode for local models (LEM via Ollama).
Same binary, two entry points.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:20:59 +00:00
2026-03-25 10:58:00 +00:00
**core-agent** is the AI agent orchestration platform for the Core ecosystem. Single Go binary that runs as an MCP server — stdio (IDE integration) or HTTP daemon (cross-agent communication).
**Module:** `dappco.re/go/agent`
## Build & Test
```bash
go build ./... # Build all packages
go build ./cmd/core-agent/ # Build the binary
go test ./... -count=1 -timeout 60s # Run all tests (840+)
go vet ./... # Vet
```
feat: add Codex extension — agents, skills, rules, config
Parallel to the Claude Code plugin (claude/), core-agent now supports
Codex with full feature parity:
- .codex/config.toml — model, profiles (review/quick/implement/lem),
MCP server, local model providers (Ollama/LM Studio)
- .codex/agents/ — reviewer, migrator, fixer (AX-aware)
- .codex/rules/ — Starlark rules for sandbox control
- .agents/skills/ — 9 skills matching Claude plugin
- AGENTS.md — Codex project instructions (like CLAUDE.md)
Supports --oss mode for local models (LEM via Ollama).
Same binary, two entry points.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:20:59 +00:00
## Architecture
```
2026-03-25 10:58:00 +00:00
cmd/core-agent/main.go Entry point (97 lines — core.New + services + Run)
pkg/agentic/ Agent orchestration: dispatch, prep, verify, scan, review
pkg/brain/ OpenBrain memory integration
pkg/lib/ Embedded templates, personas, flows, workspace scaffolds
pkg/messages/ Typed IPC message definitions (12 message types)
pkg/monitor/ Agent monitoring, notifications, completion tracking
pkg/setup/ Workspace detection and scaffolding
feat: add Codex extension — agents, skills, rules, config
Parallel to the Claude Code plugin (claude/), core-agent now supports
Codex with full feature parity:
- .codex/config.toml — model, profiles (review/quick/implement/lem),
MCP server, local model providers (Ollama/LM Studio)
- .codex/agents/ — reviewer, migrator, fixer (AX-aware)
- .codex/rules/ — Starlark rules for sandbox control
- .agents/skills/ — 9 skills matching Claude plugin
- AGENTS.md — Codex project instructions (like CLAUDE.md)
Supports --oss mode for local models (LEM via Ollama).
Same binary, two entry points.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:20:59 +00:00
```
2026-03-25 10:58:00 +00:00
### Service Registration
```go
c := core.New(
core.WithOption("name", "core-agent"),
core.WithService(agentic.ProcessRegister),
core.WithService(agentic.Register),
core.WithService(monitor.Register),
core.WithService(brain.Register),
core.WithService(mcp.Register),
)
c.Run()
```
feat: add Codex extension — agents, skills, rules, config
Parallel to the Claude Code plugin (claude/), core-agent now supports
Codex with full feature parity:
- .codex/config.toml — model, profiles (review/quick/implement/lem),
MCP server, local model providers (Ollama/LM Studio)
- .codex/agents/ — reviewer, migrator, fixer (AX-aware)
- .codex/rules/ — Starlark rules for sandbox control
- .agents/skills/ — 9 skills matching Claude plugin
- AGENTS.md — Codex project instructions (like CLAUDE.md)
Supports --oss mode for local models (LEM via Ollama).
Same binary, two entry points.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:20:59 +00:00
2026-03-25 10:58:00 +00:00
### Dispatch Flow
feat: add Codex extension — agents, skills, rules, config
Parallel to the Claude Code plugin (claude/), core-agent now supports
Codex with full feature parity:
- .codex/config.toml — model, profiles (review/quick/implement/lem),
MCP server, local model providers (Ollama/LM Studio)
- .codex/agents/ — reviewer, migrator, fixer (AX-aware)
- .codex/rules/ — Starlark rules for sandbox control
- .agents/skills/ — 9 skills matching Claude plugin
- AGENTS.md — Codex project instructions (like CLAUDE.md)
Supports --oss mode for local models (LEM via Ollama).
Same binary, two entry points.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:20:59 +00:00
2026-03-25 10:58:00 +00:00
```
dispatch → prep workspace → spawn agent in Docker container
→ agent works → completion detected via proc.Done()
→ detectFinalStatus (completed/blocked/failed)
→ onAgentComplete (save output, track rate limits, emit IPC)
→ IPC pipeline: AgentCompleted → QA → AutoPR → Verify → Merge
```
## Coding Standards
- **UK English**: colour, organisation, centre, initialise
- **Errors**: `core.E("pkg.Method", "message", err)` — NEVER `fmt.Errorf`
- **File I/O**: Package-level `fs` (go-io Medium) — NEVER `os.ReadFile/WriteFile`
2026-03-30 15:48:21 +00:00
- **Processes**: `s.Core().Process()` / go-process — NEVER `os/exec` directly
2026-03-25 10:58:00 +00:00
- **Strings**: `core.Contains/Split/Trim/HasPrefix/Sprintf` — NEVER `strings.*`
- **Returns**: `core.Result{Value, OK}` — NEVER `(value, error)` pairs
feat: add Codex extension — agents, skills, rules, config
Parallel to the Claude Code plugin (claude/), core-agent now supports
Codex with full feature parity:
- .codex/config.toml — model, profiles (review/quick/implement/lem),
MCP server, local model providers (Ollama/LM Studio)
- .codex/agents/ — reviewer, migrator, fixer (AX-aware)
- .codex/rules/ — Starlark rules for sandbox control
- .agents/skills/ — 9 skills matching Claude plugin
- AGENTS.md — Codex project instructions (like CLAUDE.md)
Supports --oss mode for local models (LEM via Ollama).
Same binary, two entry points.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:20:59 +00:00
- **Comments**: Usage examples showing HOW with real values, not descriptions
- **Names**: Predictable, unabbreviated (Config not Cfg, Service not Srv)
2026-03-25 10:58:00 +00:00
- **Commits**: `type(scope): description` with `Co-Authored-By: Virgil <virgil@lethean.io>`
- **Licence**: EUPL-1.2 — `// SPDX-License-Identifier: EUPL-1.2` on every file
feat: add Codex extension — agents, skills, rules, config
Parallel to the Claude Code plugin (claude/), core-agent now supports
Codex with full feature parity:
- .codex/config.toml — model, profiles (review/quick/implement/lem),
MCP server, local model providers (Ollama/LM Studio)
- .codex/agents/ — reviewer, migrator, fixer (AX-aware)
- .codex/rules/ — Starlark rules for sandbox control
- .agents/skills/ — 9 skills matching Claude plugin
- AGENTS.md — Codex project instructions (like CLAUDE.md)
Supports --oss mode for local models (LEM via Ollama).
Same binary, two entry points.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:20:59 +00:00
2026-03-25 10:58:00 +00:00
## Testing Convention (AX-7)
Every function gets three test categories:
```
TestFilename_FunctionName_Good — happy path, proves contract works
TestFilename_FunctionName_Bad — expected errors, proves error handling
TestFilename_FunctionName_Ugly — edge cases, panics, corruption
feat: add Codex extension — agents, skills, rules, config
Parallel to the Claude Code plugin (claude/), core-agent now supports
Codex with full feature parity:
- .codex/config.toml — model, profiles (review/quick/implement/lem),
MCP server, local model providers (Ollama/LM Studio)
- .codex/agents/ — reviewer, migrator, fixer (AX-aware)
- .codex/rules/ — Starlark rules for sandbox control
- .agents/skills/ — 9 skills matching Claude plugin
- AGENTS.md — Codex project instructions (like CLAUDE.md)
Supports --oss mode for local models (LEM via Ollama).
Same binary, two entry points.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:20:59 +00:00
```
2026-03-25 10:58:00 +00:00
One test file per source file. No catch-all files. Names must sort cleanly.
### Current Coverage
- 840 tests, 79.9% statement coverage
- 92% AX-7 (Good/Bad/Ugly) category coverage
## Process Execution
2026-03-30 15:48:21 +00:00
All external commands go through `s.Core().Process()` → go-process:
2026-03-25 10:58:00 +00:00
```go
2026-03-30 15:48:21 +00:00
process := s.Core().Process()
out := process.RunIn(ctx, dir, "git", "log", "--oneline")
ok := process.RunIn(ctx, dir, "git", "fetch", "origin", "main").OK
branchResult := process.RunIn(ctx, dir, "git", "rev-parse", "--abbrev-ref", "HEAD")
branch := core.Trim(branchResult.Value.(string))
2026-03-25 10:58:00 +00:00
```
**NEVER import `os/exec` .** Zero source files do.
## MCP Tools (33)
| Category | Tools |
|----------|-------|
| Dispatch | `agentic_dispatch` , `agentic_dispatch_remote` , `agentic_status` , `agentic_status_remote` |
| Workspace | `agentic_prep_workspace` , `agentic_resume` , `agentic_watch` |
| PR/Review | `agentic_create_pr` , `agentic_list_prs` , `agentic_create_epic` , `agentic_review_queue` |
| Mirror | `agentic_mirror` (Forge → GitHub sync) |
| Scan | `agentic_scan` (Forge issues) |
| Brain | `brain_recall` , `brain_remember` , `brain_forget` |
| Messaging | `agent_send` , `agent_inbox` , `agent_conversation` |
| Plans | `agentic_plan_create/read/update/delete/list` |
| Files | `file_read/write/edit/delete/rename/exists` , `dir_list/create` |
| Language | `lang_detect` , `lang_list` |
## Key Paths
| Function | Returns |
|----------|---------|
| `WorkspaceRoot()` | `$CORE_WORKSPACE/workspace` or `~/Code/.core/workspace` |
| `CoreRoot()` | `$CORE_WORKSPACE` or `~/Code/.core` |
| `PlansRoot()` | `$CORE_WORKSPACE/plans` |
| `AgentName()` | `$AGENT_NAME` or hostname-based detection |
| `GitHubOrg()` | `$GITHUB_ORG` or `dAppCore` |
## Branch Strategy
feat: add Codex extension — agents, skills, rules, config
Parallel to the Claude Code plugin (claude/), core-agent now supports
Codex with full feature parity:
- .codex/config.toml — model, profiles (review/quick/implement/lem),
MCP server, local model providers (Ollama/LM Studio)
- .codex/agents/ — reviewer, migrator, fixer (AX-aware)
- .codex/rules/ — Starlark rules for sandbox control
- .agents/skills/ — 9 skills matching Claude plugin
- AGENTS.md — Codex project instructions (like CLAUDE.md)
Supports --oss mode for local models (LEM via Ollama).
Same binary, two entry points.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:20:59 +00:00
- Work on `dev` branch, never push to `main` directly
2026-03-25 10:58:00 +00:00
- PRs required for `main`
feat: add Codex extension — agents, skills, rules, config
Parallel to the Claude Code plugin (claude/), core-agent now supports
Codex with full feature parity:
- .codex/config.toml — model, profiles (review/quick/implement/lem),
MCP server, local model providers (Ollama/LM Studio)
- .codex/agents/ — reviewer, migrator, fixer (AX-aware)
- .codex/rules/ — Starlark rules for sandbox control
- .agents/skills/ — 9 skills matching Claude plugin
- AGENTS.md — Codex project instructions (like CLAUDE.md)
Supports --oss mode for local models (LEM via Ollama).
Same binary, two entry points.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:20:59 +00:00
- Use `go get -u ./...` for dependency updates, never manual go.mod edits