AGENTS.md · diff
git:20261108.f69b1b1 to git:20261108.6e88f22
7 added, 19 removed. Audit A to A.
# Repository Guidelines
## Project Structure & Module Organization
- `cmd/mistermorph/`: CLI entrypoint and subcommands.
- `agent/`: agent engine (loop, parsing, prompts, logging).
- `llm/`: shared LLM types/interfaces used by the agent and providers.
- `providers/`: LLM backends (currently `providers/uniai/`).
- `tools/` and `tools/builtin/`: tool registry and built-ins (`web_search`, `url_fetch`, `bash`, `read_file`).
- `skills/`: skill discovery and selection logic for `SKILL.md`.
- `demo/`: embedding examples (`demo/embed-go/`, `demo/embed-cli/`).
- `wrappers/acp/`: optional stdio bridges for external ACP agents (Codex app-server, Claude Code print mode, Cursor CLI `agent acp` proxy).
- Root configs: `assets/config/config.example.yaml` (template) and `config.yaml` (local). `mistermorph` in repo root is a build artifact.
## Build, Test, and Development Commands
- Build: `go build -o ./bin/mistermorph ./cmd/mistermorph`
- Run (no build): `go run ./cmd/mistermorph --help`
- Test: `go test ./...`
- Static checks: `go vet ./...`
- Example run:
- `./bin/mistermorph run --task "Summarize this repo" --provider openai --model gpt-5.2 --api-key "$OPENAI_API_KEY"`
- ### Console Frontends
-
- There are two consoles. A request about "the Console" (its UI, the mobile view, the desktop or
- Android app) is about the nsh console unless it names the Vue one.
-
- - `web/console-nsh`: the nsh (TSX) console. It is what the desktop app, the Android app and the
- web console built by `scripts/build-backend.sh` (the default `--console nsh`) show.
- - Type check: `nsh check`; tests: `nsh test --web-host tests/noHost.js` (both in `web/console-nsh`).
- - Web build: `web/console-nsh/scripts/build-web.sh <dir>`; Android: `web/console-nsh/scripts/build-android.sh`.
- - `web/console-nsh/PORTING.md` lists the nsh traps already found.
- - `web/console`: the Vue console, the reference design the nsh console was ported from, and what
- the release workflow embeds in the CLI.
+ ### Console (`web/console-nsh`)
- ### Vue Console (`web/console`)
+ The Console is a TSX app on nsh (0.4.0). The web Console, the desktop app (`desktop/nsh`) and the
+ Android app are all built from it; the CLI embeds its web build.
- - Package manager: use `pnpm` (do not use `npm`).
- - Allowed commands:
- - `pnpm install`
- - `pnpm add <pkg>`
- - `pnpm dev`
- - `pnpm build`
+ - Type check: `nsh check`; tests: `nsh test --web-host tests/noHost.js` (both in `web/console-nsh`).
+ - Web build: `web/console-nsh/scripts/build-web.sh <dir>`; Android: `web/console-nsh/scripts/build-android.sh`.
+ - `scripts/build-backend.sh` builds the web Console, stages it and builds the backend with it embedded.
+ - `web/console-nsh/PORTING.md` lists the nsh traps already found.
## Demos (Embedding)
- Go library demo: `cd demo/embed-go && OPENAI_API_KEY="..." go run . --task "List files and summarize."`
- CLI subprocess demo: `go build -o ./bin/mistermorph ./cmd/mistermorph`, then `cd demo/embed-cli && MISTER_MORPH_BIN=../../bin/mistermorph OPENAI_API_KEY="..." go run . --task "Search for OpenAI and fetch the first result"`
- Both demos require network access (OpenAI-compatible provider).
## Coding Style & Naming Conventions
- Format Go code with `gofmt` (`go fmt ./...` is fine for day-to-day).
- Package names are lowercase; exported identifiers use `PascalCase`; locals use `camelCase`.
- Keep provider-specific behavior in `providers/<name>/` and avoid leaking it into `agent/`.
## Testing Guidelines
- Use the standard `testing` package; colocate tests as `*_test.go` next to the code they cover.
- Prefer table-driven tests and subtests (`t.Run("case", ...)`) for tool/provider edge cases.
## Agent Hooks & Webhooks
- There’s no built-in inbound webhook/HTTP server.
- The engine supports step hooks via `agent.Hook` + `agent.WithHook(...)` (runs once per step, before the LLM call).
- For outgoing webhooks and complex HTTP needs, implement it in a hook or use a tool; built-in `url_fetch` supports GET/POST/PUT/DELETE with optional headers/body.
## Security & Configuration Tips
- Prefer `MISTER_MORPH_API_KEY` over committing `api_key` in config; treat logs as sensitive when enabling debug/thought output.
- When adding/changing config keys, update `assets/config/config.example.yaml` (the template used for docs and examples).
## Model Catalogs
- Model pricing comes from uniai (`uniai.DefaultPricingCatalog`, picked up by bumping the uniai version). Each time model pricing is updated (new models or new prices), update the context window sizes in `llm/model_context_windows.yaml` as well: add every new model (with its common aliases), and correct changed windows.
- Take window sizes only from the provider's official docs, and record the page in `sources` with the `checked_at` date. Do not guess a size; leave a model out until its docs state one.
- Add new models to the lookup checks in `llm/model_context_window_catalog_test.go`.
## Commit & Pull Request Guidelines
- This checkout may not include Git history; if it does, match existing conventions. Otherwise, use Conventional Commits (`feat:`, `fix:`, `docs:`, `refactor:`).
- PRs should include: a clear description of the behavior change, how to run it locally, and any config/flag updates.