feat: config with agents rework
This commit is contained in:
55
AGENTS.md
55
AGENTS.md
@@ -106,6 +106,37 @@ meta = with lib; {
|
||||
|
||||
**Shared lib**: `portsLib = import ../../lib/ports.nix { inherit lib; }; portHelpers = portsLib.mkPortHelpers { ... };`
|
||||
|
||||
## LIBRARY FUNCTIONS
|
||||
|
||||
### `lib.ports`
|
||||
|
||||
Port management utilities. See [Port Management](#port-management).
|
||||
|
||||
### `lib.agents`
|
||||
|
||||
Harness-agnostic agent management. Reads canonical `agent.toml` from the AGENTS
|
||||
flake input and renders tool-specific configs.
|
||||
|
||||
**Functions:**
|
||||
|
||||
| Function | Purpose |
|
||||
|----------|--------|
|
||||
| `loadCanonical { agentsInput }` | Load canonical agents from AGENTS flake |
|
||||
| `renderForOpencode { pkgs, canonical, modelOverrides }` | Render to OpenCode file-based agents |
|
||||
| `renderForClaudeCode { pkgs, canonical, modelOverrides }` | Render to Claude Code agents + settings.json |
|
||||
| `renderForPi { pkgs, canonical }` | Render to Pi AGENTS.md + SYSTEM.md |
|
||||
| `renderForTool { pkgs, agentsInput, tool, modelOverrides }` | Dispatch to correct renderer |
|
||||
| `shellHookForTool { pkgs, agentsInput, tool, modelOverrides }` | Generate devShell shellHook |
|
||||
|
||||
### `lib.coding-rules`
|
||||
|
||||
Coding rules injection (renamed from `lib.opencode-rules`). The old name still works.
|
||||
|
||||
| Function | Purpose |
|
||||
|----------|--------|
|
||||
| `mkCodingRules { agents, languages, concerns, frameworks }` | Generate rules config + shellHook |
|
||||
| `mkOpencodeRules` | Backward-compat alias for `mkCodingRules` |
|
||||
|
||||
## PORT MANAGEMENT
|
||||
|
||||
Central port management: `config.m3ta.ports.get "service"` with host-specific via `hostOverrides`
|
||||
@@ -168,3 +199,27 @@ Use `td usage -q` for subsequent reads.
|
||||
- `td version` - Check version
|
||||
|
||||
For full workflow details, see the [td documentation](./docs/packages/td.md).
|
||||
|
||||
## MIGRATION: Agent System (OpenCode → Canonical TOML)
|
||||
|
||||
The agent system was migrated from embedded `agents.json` to harness-agnostic
|
||||
canonical `agent.toml` + `system-prompt.md` in the AGENTS repo. Renderers in
|
||||
`lib/agents.nix` generate tool-specific configs.
|
||||
|
||||
### What changed in this repo
|
||||
|
||||
- **`lib/agents.nix`**: New — 3 renderers (OpenCode, Claude Code, Pi) + dispatcher + shellHook
|
||||
- **`lib/coding-rules.nix`**: Renamed from `opencode-rules.nix`, `mkCodingRules` replaces `mkOpencodeRules`
|
||||
- **`modules/home-manager/coding/agents/`**: New — per-tool HM sub-modules
|
||||
- **`modules/home-manager/coding/opencode.nix`**: Slimmed — no longer handles agents/skills/context
|
||||
- **`flake.nix`**: Exports new `agents` HM module
|
||||
|
||||
### What the user must do
|
||||
|
||||
See `modules/home-manager/AGENTS.md` for the full migration guide. Summary:
|
||||
|
||||
1. Move `agentsInput`/`externalSkills` from `coding.opencode` to `coding.agents.opencode`
|
||||
2. Add `modelOverrides` with previously hardcoded model strings
|
||||
3. Run `home-manager switch`
|
||||
4. Remove legacy `agents.json` + `prompts/*.txt` from AGENTS repo
|
||||
5. Remove `lib.agentsJson` backward-compat bridge from AGENTS `flake.nix`
|
||||
|
||||
Reference in New Issue
Block a user