[agent/codex] Fix ALL AX findings in pkg/brain/direct.go. Read CODEX.md. O... #9

Merged
Virgil merged 5 commits from agent/fix-all-ax-findings-in-pkg-brain-direct into dev 2026-03-22 13:03:20 +00:00
Member

Task

Fix ALL AX findings in pkg/brain/direct.go. Read CODEX.md. ONLY modify Go files in pkg/brain/. Do NOT touch PHP files. Replace: os.Getenv → core.Env, os.UserHomeDir → core.Env("DIR_HOME"). Add usage-example comments to all exported types in pkg/brain/tools.go and pkg/brain/provider.go. Build must pass: go build ./...

Agent: codex
Commits: 1
Branch: agent/fix-all-ax-findings-in-pkg-brain-direct


Auto-created by core-agent dispatch system.
Co-Authored-By: Virgil virgil@lethean.io

## Task Fix ALL AX findings in pkg/brain/direct.go. Read CODEX.md. ONLY modify Go files in pkg/brain/. Do NOT touch PHP files. Replace: os.Getenv → core.Env, os.UserHomeDir → core.Env("DIR_HOME"). Add usage-example comments to all exported types in pkg/brain/tools.go and pkg/brain/provider.go. Build must pass: go build ./... **Agent:** codex **Commits:** 1 **Branch:** `agent/fix-all-ax-findings-in-pkg-brain-direct` --- Auto-created by core-agent dispatch system. Co-Authored-By: Virgil <virgil@lethean.io>
Virgil added 5 commits 2026-03-22 13:03:04 +00:00
- 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>
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>
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>
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>
Co-Authored-By: Virgil <virgil@lethean.io>
Virgil merged commit 850ff4bc03 into dev 2026-03-22 13:03:20 +00:00
Virgil deleted branch agent/fix-all-ax-findings-in-pkg-brain-direct 2026-03-22 13:03:20 +00:00
Author
Member

Auto-Verified & Merged

Tests: go test ./... — PASS

Auto-merged by core-agent dispatch system.

## Auto-Verified & Merged **Tests:** `go test ./...` — PASS Auto-merged by core-agent dispatch system.
Sign in to join this conversation.
No description provided.