Commit graph

209 commits

Author SHA1 Message Date
Snider
6e37bd22f0 feat: devops plugin, CLI commands, Codex dispatch fixes, AX sweep
DevOps plugin (5 skills):
- install-core-agent, repair-core-agent, merge-workspace,
  update-deps, clean-workspaces

CLI commands: version, check, extract for diagnostics.

Codex dispatch: --skip-git-repo-check, removed broken
--model-reasoning-effort, --sandbox workspace-write via
--full-auto. Workspace template extracts to wsDir not srcDir.

AX sweep (Codex-generated): sanitise.go extracted from prep/plan,
mirror.go JSON parsing via encoding/json, setup/config.go URL
parsing via net/url, strings/fmt imports eliminated from setup.

CODEX.md template updated with Env/Path patterns.
Review workspace template with audit-only PROMPT.md.
Marketplace updated with devops plugin.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 15:45:16 +00:00
Snider
98baa1b08f feat: inline tests + Fs zero-value fix + coverage 76.9% → 82.3%
Move all tests from tests/ to package root for proper coverage.
Fix Fs zero-value: path() and validatePath() default empty root
to "/" so &Fs{} works without New().

New tests: PathGlob, PathIsAbs, CleanPath, Cli.SetOutput,
ServiceShutdown, Core.Context, Fs zero-value, Fs protected
delete, Command lifecycle with implementation, error formatting
branches, PerformAsync completion/no-handler/after-shutdown,
Extract with templates, Embed path traversal.

Coverage: 76.9% → 82.3% (23 test files, 82 new test cases).

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 15:45:04 +00:00
7f87e4d52c Merge pull request '[agent/codex] Fix ALL high-severity AX findings in pkg/monitor/ (monitor.g...' (#10) from agent/fix-all-high-severity-ax-findings-in-pkg into dev 2026-03-22 13:41:29 +00:00
Snider
9aac4c19dd refactor(monitor): adopt core helpers
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 13:40:14 +00:00
850ff4bc03 Merge pull request '[agent/codex] Fix ALL AX findings in pkg/brain/direct.go. Read CODEX.md. O...' (#9) from agent/fix-all-ax-findings-in-pkg-brain-direct into dev 2026-03-22 13:03:19 +00:00
Snider
ed842122a2 fix(brain): resolve direct AX findings
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 13:02:37 +00:00
Snider
a422eb1b6b feat(lib): add go.work.tmpl to workspace template
Codex agents are sandboxed to src/ and don't get ~/Code/go.work.
This template creates a go.work with `use .` so the Go toolchain
works in workspace mode inside the sandbox.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 10:18:57 +00:00
Snider
6393bfe4da refactor(agentic): adopt core.Env() + core.Path() across package
Replace all os.UserHomeDir/os.Getenv/os.Hostname with core.Env().
Replace all filepath.Base/Dir/Glob/IsAbs with core.PathBase/PathDir/
PathGlob/PathIsAbs.

10 files migrated: paths, prep, review_queue, remote, dispatch,
ingest, mirror, plan, verify, watch.

Imports eliminated: 5x os, 7x filepath. All file I/O and path
construction now routes through Core primitives.

Bumps dappco.re/go/core to v0.6.0.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 10:15:15 +00:00
Snider
3022f05fb8 refactor(agentic): route file I/O through core.Fs
Replace raw os.* file operations with Core Fs equivalents:
- os.Stat → fs.Exists/fs.IsFile/fs.IsDir (resume, pr, plan, mirror, prep)
- os.ReadDir → fs.List (queue, status, plan, mirror, review_queue)
- os.Remove → fs.Delete (dispatch)
- os.OpenFile(append) → fs.Append (events, review_queue)
- strings.Replace → core.Replace (scan)

Eliminates os import from resume.go, pr.go. Eliminates strings
import from scan.go. Trades os for io in events.go.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 09:08:45 +00:00
Snider
ede5d6f561 feat(lib): migrate to Core Embed system with Result returns
- All public functions return core.Result instead of (string, error)
- Mount scopes basedir — no path prefix needed in ReadString calls
- Add Bundle struct replacing (string, map, error) anti-pattern
- listDir takes *core.Embed not embed.FS
- ListTasks/ListPersonas use FS() + BaseDirectory() for WalkDir
- Remove bytes, os, text/template imports
- 22 tests: Prompt, Task, TaskBundle, Flow, Persona, Template,
  List functions, ExtractWorkspace (Good/Bad patterns)

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 09:08:35 +00:00
Snider
3c5e6d6498 fix(lib): ExtractWorkspace now recurses into subdirectories
Was skipping directories entirely (`if entry.IsDir() { continue }`),
so .core/reference/ and its contents were never extracted.
Replaced fs.ReadDir loop with fs.WalkDir to handle nested dirs.

Added tests: CreatesFiles, CreatesSubdirectories, TemplateSubstitution.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 08:10:56 +00:00
Snider
e8ca0d856f feat(lib): embed Core documentation in workspace template
18 doc files from core/go/docs — getting-started, primitives,
services, commands, configuration, errors, lifecycle, messaging,
subsystems, testing. Agents can read full Core documentation
without network access.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 07:19:20 +00:00
Snider
5417f547ca feat(lib): add Core struct reference to CODEX.md template
Documents all subsystem accessors (App, Fs, Config, Data, Drive, Log,
Error, Cli, IPC, I18n, Options, Context), service lifecycle with
Startable/Stoppable interfaces, error logging (LogError/LogWarn/Must),
and async tasks (Perform/PerformAsync/Progress).

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 07:17:27 +00:00
Snider
71ee6124b7 feat(lib): complete CODEX.md with all Core patterns
Added: Embed/Mount/Extract, error wrapping/codes/introspection,
Print, Array[T], Config, IPC (Action/Query/Perform), Services,
Commands, Drive, I18n. Every Core primitive documented with
WRONG/CORRECT examples.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 07:15:20 +00:00
Snider
99e1d06fda feat(lib): add CODEX.md template to default workspace
Inline instructions for Codex agents — no spec references,
just the actual rules with code examples. Extracted into every
workspace automatically.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 07:13:12 +00:00
Snider
b9c30138fb fix(lib): rename .gitignore to .gitignore.tmpl in workspace template
Prevents git from ignoring template contents. ExtractWorkspace strips
the .tmpl suffix during extraction.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 07:02:32 +00:00
Snider
6f5b239da6 feat(lib): embed AX spec + Core source in default workspace template
Reference files (.core/reference/) are now part of the embedded
workspace template. ExtractWorkspace extracts them automatically —
no hardcoded filesystem paths, ships with the binary.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:59:52 +00:00
Snider
4f66eb4cca fix: resolve final AX audit findings
- cmd/main.go: keyed core.Result literals (go vet clean)
- pkg/brain/direct.go: compile-time mcp.Subsystem assertion
- pkg/monitor/monitor.go: compile-time Subsystem + CompletionNotifier assertions
- pkg/agentic/prep.go: alias stdlib io as goio
- pkg/agentic/remote_client.go: UK English (initialise/initialised)
- pkg/monitor/monitor_test.go: updated inbox tests for current contract

AX audit now returns 0 convention findings.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:42:42 +00:00
Snider
7873e0ebf7 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
Snider
a0dc9c32e7 refactor: migrate core/agent to Core primitives — reference implementation
Phase 1: go-io/go-log → core.Fs{}, core.E(), core.Error/Info/Warn
Phase 2: strings/fmt → core.Contains, core.Sprintf, core.Split etc
Phase 3: embed.FS → core.Mount/core.Embed, core.Extract
Phase 4: cmd/main.go → core.Command(), c.Cli().Run(), no cli package

All packages migrated:
- pkg/lib (Codex): core.Mount, core.Extract, Result returns, AX comments
- pkg/setup (Codex): core.Fs, core.E, fixed missing lib helpers
- pkg/brain (Codex): Core primitives, AX comments
- pkg/monitor (Codex): Core string/logging primitives
- pkg/agentic (Codex): 20 files, Core primitives throughout
- cmd/main.go: pure Core CLI, no fmt/log/filepath/strings/cli

Remaining stdlib: path/filepath (Core doesn't wrap OS paths),
fmt.Sscanf/strings.Map (no Core equivalent).

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:13:41 +00:00
Snider
6db0110b6f refactor(brain): consolidate newFs and agentName wrappers
Remove duplicated newFs() from brain package — use agentic.LocalFs() instead.
Inline agentName() wrapper — call agentic.AgentName() directly.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 03:47:08 +00:00
Snider
b266db5069 fix(pkg): address code review findings
- Fix import ordering in verify.go and remote_client.go (stdlib before third-party)
- Convert os.MkdirAll to fs.EnsureDir in prep.go
- Preserve underlying error in !r.OK branches (writeStatus, writePlan, planDelete, planList, resume)

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 03:45:50 +00:00
Snider
0f0764ff59 fix(agentic): update auto_pr.go to use exported DefaultBranch
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 03:43:17 +00:00
Snider
deaa06a54d refactor(pkg): migrate go-io/go-log to Core primitives
Replace separate go-io (coreio) and go-log (coreerr) packages with
Core's built-in Fs and error/logging functions. This is the reference
implementation for how all Core ecosystem packages should migrate.

Changes:
- coreio.Local.Read/Write/EnsureDir/Delete/IsFile → core.Fs methods
- coreerr.E() → core.E(), coreerr.Info/Warn/Error → core.Info/Warn/Error
- (value, error) return pattern → core.Result pattern (r.OK, r.Value)
- go-io and go-log moved from direct to indirect deps in go.mod
- Added AX usage-example comments on key public types
- Added newFs("/") helper for unrestricted filesystem access

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 03:41:07 +00:00
Snider
52c3e67692 fix(plugin): rename CoreAgent→core, CorePHP→core-php
Plugin names must match their directory/reference names.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 02:22:26 +00:00
162c2beeab Merge pull request 'chore: dappco.re migration + plugin version bump' (#5) from dev into main
Some checks failed
CI / test (push) Failing after 4s
2026-03-22 02:17:42 +00:00
Snider
0be5791fc4 chore: bump core-research plugin to 0.3.0
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 02:15:39 +00:00
Snider
3c49620548 chore: bump plugin version to 0.14.0
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 02:14:36 +00:00
Snider
c6490c175a refactor: migrate imports to dappco.re paths + bump mcp to v0.4.0
Update all go-* imports from forge.lthn.ai to dappco.re/go/core/*.
Bump mcp to v0.4.0 (Options{} struct API).
Versions: core v0.5.0, io v0.2.0, log v0.1.0, process v0.3.0,
ws v0.3.0, ai v0.2.0, webview v0.2.0, i18n v0.2.0.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 01:27:48 +00:00
94af637411 Merge pull request '[agent/claude] Write tests for /pkg/monitor/ to reach 80% coverage. Current...' (#2) from agent/write-tests-for--pkg-monitor--to-reach-8 into main
Some checks failed
CI / test (push) Failing after 2s
2026-03-22 00:46:00 +00:00
Snider
2d58145e65 test(monitor): add unit tests for completions, inbox, lifecycle
Cover checkCompletions, checkInbox, syncRepos, loop, Poke,
Start/Shutdown, New, initSyncTimestamp, and agentStatusResource.
Mock HTTP endpoints with httptest, use t.TempDir for workspace
scanning, and create fake status.json files for completions.

Also fix dispatch.go build error (removed unsupported RunOptions
fields: KillGroup, Timeout, GracePeriod).

Coverage: 23.2% → 86.5%

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 00:45:43 +00:00
ddaf950654 Merge pull request '[agent/claude] Write tests for /pkg/agentic/ to improve coverage. Current c...' (#4) from agent/write-tests-for--pkg-agentic--to-improve into main
Some checks are pending
CI / test (push) Waiting to run
2026-03-22 00:45:19 +00:00
e2d26dccc1 Merge pull request '[agent/claude] Write tests for /pkg/brain/ to reach 80% coverage. Current c...' (#3) from agent/write-tests-for--pkg-brain--to-reach-80 into main
Some checks are pending
CI / test (push) Waiting to run
2026-03-22 00:45:08 +00:00
Snider
05f120b166 Merge remote-tracking branch 'github/dev'
Some checks failed
CI / test (push) Failing after 3s
2026-03-22 00:29:11 +00:00
Snider
ddf765dee1 fix(dispatch): use correct Codex CLI flags (exec --full-auto)
Some checks failed
CI / test (push) Failing after 3s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-21 21:26:13 +00:00
Snider
5393828ac6 feat(monitor): include message content in inbox channel events
Some checks failed
CI / test (push) Failing after 3s
inbox.message events now include full message objects (id, from,
subject, content) so recipients can read messages inline without
calling agent_inbox. Charon's messages arrive directly in session.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-21 20:08:13 +00:00
Snider
81806e5dcc chore: plugin v0.13.0, research v0.2.0, marketplace naming + MONITOR_INTERVAL
Some checks failed
CI / test (push) Failing after 3s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-21 20:01:51 +00:00
Snider
0fda800e8b chore(monitor): remove debug logging from check cycle
Some checks failed
CI / test (push) Failing after 3s
Debug channel events and stderr logging removed — monitor runs
silently unless something actually happens. Only real events
(agent.complete, inbox.message, harvest.complete) fire now.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-21 19:42:38 +00:00
Snider
5a234c1179 fix(monitor): seed completions on startup, suppress initial flood
Some checks failed
CI / test (push) Failing after 3s
Both checkCompletions and checkInbox now seed on first run —
existing workspaces and messages are recorded without firing
channel events. Only genuinely new events trigger notifications.

Tests updated to pre-seed flags and filter debug events.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-21 19:38:03 +00:00
Snider
36dc76cce1 feat(monitor): ID-based inbox detection + channels fully working
Some checks failed
CI / test (push) Failing after 3s
Track inbox by highest message ID instead of unread count. Fixes:
- API pagination limit (max 20) no longer causes missed notifications
- Restart no longer floods with all existing unread messages (seeded)
- Each new message fires exactly once regardless of read state

Added MONITOR_INTERVAL env override and debugChannel helper for
faster iteration during channel development.

All three channel types confirmed working:
- agent.complete: workspace status changes
- inbox.message: new messages by ID tracking
- monitor.debug: real-time debug trace

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-21 19:31:11 +00:00
Snider
1e9278fd9d feat(monitor): channels working — inbox uses {data:[...]} + debug events
Some checks failed
CI / test (push) Failing after 3s
Fixed inbox API response parsing: {data:[...]} not {messages:[...]}.
Added debugChannel helper for real-time debug events via channels.
MONITOR_INTERVAL env override for faster iteration.

Channels confirmed working:
- agent.complete: workspace status changes
- inbox.message: unread message notifications
- monitor.debug: debug trace events

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-21 19:24:07 +00:00
Snider
b5dcdd1261 fix(monitor): inbox API returns {data:[...]} not {messages:[...]}
Some checks failed
CI / test (push) Failing after 3s
The MCP agent_inbox tool wraps the response as {messages:[...]},
but the raw API returns {data:[...]}. The monitor calls the raw
API directly, so it needs to parse {data:[...]}.

Verified with curl against live API. Removed debug channel events.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-21 19:17:53 +00:00
Snider
62b9ee7729 refactor(plugin): split research skills into separate plugin
Some checks failed
CI / test (push) Failing after 3s
New plugin: claude/research (core-research v0.1.0)
- 12 collection/research skills moved from core
- collection subsystem (hooks, scripts) moved
- Installed separately when research work is needed

Core plugin bumped to v0.12.0 — now focused on:
- Dispatch, review, messaging, OpenBrain (operational)
- Deploy, app-split, repo-sweep (infrastructure)
- Architecture review, security review (quality)

Marketplace updated with CoreResearch entry.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-21 18:16:06 +00:00
Snider
287a4cf110 fix(plugin): address validation findings — commands + skill frontmatter
Some checks failed
CI / test (push) Failing after 3s
Critical: /core:remember rewritten to use brain_remember MCP tool
instead of missing capture-context.sh script.

Major: /core:pipeline persona paths fixed — now reference
pkg/lib/persona/ with correct slugs instead of nonexistent
agents/engineering/ directory.

Major: Added YAML frontmatter (name + description) to all 12
collection skill SKILL.md files for Claude Code auto-discovery.

Removed empty channel/ directory.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-21 18:12:40 +00:00
Snider
6d28fc439b docs: update known-issues after 9 rounds of Codex review
Some checks failed
CI / test (push) Failing after 2s
77+ findings across 9 rounds, 73+ fixed. False positive rate
climbing in round 9 — codebase is converging.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-21 17:57:55 +00:00
Snider
92b7b08113 fix: Codex round 9 — verify push target, plan path traversal, mirror branch
Some checks failed
CI / test (push) Failing after 3s
High: verify rebase push now targets Forge remote, not local origin
High/Security: planPath sanitises ID via filepath.Base to prevent
path traversal in plan read/update/delete
Medium: mirror compares and pushes local default branch, not HEAD

Findings 3-6 verified as false positives/known issues (bridge async
by design, API returns top-level memories not {data:...}, inbox uses
{messages:...} confirmed against live API).

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-21 17:57:03 +00:00
Snider
6da52aa60f fix: Codex round 8 — remote success propagation + stale question cleanup
Some checks failed
CI / test (push) Failing after 3s
Medium: remote dispatch now propagates inner dispatchOut.Success
instead of hardcoding true.

Low: updateStatus clears stale question field when new state
has no question, preventing leftover rejection messages.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-21 17:46:04 +00:00
Snider
d94eed0b54 docs: Codex review pipeline — forge → github polish + LEM training
Some checks failed
CI / test (push) Failing after 3s
Proven workflow from 7 rounds on core/agent (74 findings, 70+ fixed).
Forge keeps full history, GitHub gets squashed releases. Codex findings
become LEM training data. Charon owns the pipeline.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-21 17:42:28 +00:00
Snider
40d2b0db16 fix: address Codex round 7 — path traversal + dispatch check
Some checks failed
CI / test (push) Failing after 2s
High/Security: sanitise input.Repo via filepath.Base to prevent
path traversal in workspace prep (../escape from CODE_PATH).

High/Security: sanitise repo.Repo from API response in syncRepos
to prevent path traversal via crafted checkin responses.

Medium: dispatchFixFromQueue now returns error, review_queue checks
success before recording fix_dispatched.

Known issues updated with async bridge provider findings.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-21 17:25:23 +00:00
Snider
013396bf91 docs: record known issues from 7 rounds of Codex review
Some checks failed
CI / test (push) Failing after 3s
API enhancements, test coverage gaps, conventions, and compile
issues — all acknowledged and tracked for future work.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-21 17:22:17 +00:00