diff --git a/.opencode/agents/code-reviewer.md b/.opencode/agents/code-reviewer.md index bc75e05..dfe3129 100644 --- a/.opencode/agents/code-reviewer.md +++ b/.opencode/agents/code-reviewer.md @@ -96,14 +96,14 @@ Verify: - Edge cases considered - No brittle tests (over-mocked, timing-dependent) -#### D. Static Analysis (Deno toolchain) +#### D. Static Analysis (Rust toolchain) -Run the project's type check, lint, and format commands: +Run the project's build, lint, and format commands: ```bash -deno check mod.ts src/graphs/mod.ts src/sqlite/mod.ts # Type check -deno lint # Lint (slow-types excluded per project config) -deno fmt --check # Format check +cargo build # Build check +cargo clippy -- -D warnings # Lint +cargo fmt --check # Format check ``` #### D2. Project Convention Checks @@ -111,12 +111,13 @@ deno fmt --check # Format check For this project, also verify: - No comments in code (per project convention) -- Slow types are only in known problem areas (drizzle ORM generics) — no new - slow types outside those -- Imports use explicit `.ts` extensions (Deno convention) -- TypeBox schemas are values+types (no `import type` for schema symbols) -- Entry points are `mod.ts` files that re-export -- Clients are injectable (no module-level side effects, no env vars) +- Error handling uses `anyhow::Result` (application) / `thiserror` (library) — no + panics in library code +- Feature flags are used correctly (`tls`, `iroh`, `acme`) — base crate compiles + lean +- Public API is well-documented with `///` doc comments where appropriate +- Module structure follows Rust conventions (`mod.rs`, `lib.rs`) +- No unnecessary `unwrap()` or `expect()` in library code #### E. Security diff --git a/.opencode/agents/coordinator.md b/.opencode/agents/coordinator.md index 1b049fd..4bb7602 100644 --- a/.opencode/agents/coordinator.md +++ b/.opencode/agents/coordinator.md @@ -91,7 +91,7 @@ This is the most critical coordinator responsibility. Follow it exactly: 3. **Validate after every merge:** ```bash - deno check mod.ts src/graphs/mod.ts src/sqlite/mod.ts && deno lint && deno test --allow-all test/ + cargo build && cargo clippy -- -D warnings && cargo test ``` Never skip this. A merge that breaks the build is worse than no merge. @@ -184,14 +184,14 @@ also include: `git fetch origin && git merge origin/main --no-edit` before starting, since main may have advanced since their worktree was created 3. **Key references** — Which source files and architecture docs to read -4. **Project constraints** — Important rules from the repo (no comments, TypeBox - not Zod, etc.) +4. **Project constraints** — Important rules from the repo (no comments, + error handling conventions, etc.) 5. **Done signal** — Use `worktree({action: "notify", ...})` when complete Example prompt template: ``` -You are an implementation specialist for the @alkdev/storage project. +You are an implementation specialist for the @alkdev/wraith project. Your task: {{task}} @@ -199,19 +199,18 @@ Your task: {{task}} 2. Read the task file, then read all referenced source files and architecture docs. 3. Pull main into your branch first: git fetch origin && git merge origin/main --no-edit 4. Implement the changes, following all acceptance criteria. -5. Run deno check mod.ts src/graphs/mod.ts src/sqlite/mod.ts, deno lint, deno test --allow-all test/. Fix any failures. +5. Run cargo build, cargo clippy -- -D warnings, cargo test, cargo fmt --check. Fix any failures. 6. Commit ONLY source code — do not commit task files (tasks/*.md). The coordinator manages task status on main. 7. Push: git push origin $(git branch --show-current) 8. Notify: worktree({action: "notify", args: {message: "Task completed: {{task}}. ", level: "info"}}) -Key project constraints (@alkdev/storage): -- Deno-first: use deno check, deno lint, deno fmt, deno test (not npm) +Key project constraints (@alkdev/wraith): +- Rust: use cargo build, cargo clippy, cargo fmt, cargo test - No comments in code -- TypeBox (not Zod): use @alkdev/typebox and @alkdev/drizzlebox -- JSR slow types excluded (known debt in drizzle generics) -- Injectable clients, no module-level side effects -- Import .ts extensions explicitly -- TypeBox schemas are values+types (no import type for schema symbols) +- anyhow::Result for application errors, thiserror for library error types +- Feature flags for transports (tls, iroh, acme) +- Async via tokio runtime +- No panics in library code ``` ### Partial Generation Spawning @@ -230,7 +229,7 @@ For example, if Generation 2 has tasks A (depends on X), B (depends on Y), and C ### Overlap Awareness When spawning parallel tasks, check if they modify overlapping source files. -Tasks that share source files (e.g., both modify `src/call.ts`) are likely to +Tasks that share source files (e.g., both modify `src/transport.rs`) are likely to cause merge conflicts. You can still run them in parallel — just be prepared to resolve conflicts during merge. diff --git a/.opencode/agents/implementation-specialist.md b/.opencode/agents/implementation-specialist.md index 0451c87..6c92f88 100644 --- a/.opencode/agents/implementation-specialist.md +++ b/.opencode/agents/implementation-specialist.md @@ -61,10 +61,10 @@ worktree. This means: ```bash # ✅ CORRECT — workdir is auto-injected -deno test --allow-all test/ +cargo test # ✅ ALSO CORRECT — explicit workdir still works -bash({ command: "npm test", workdir: "/path/to/worktree" }) +bash({ command: "cargo test", workdir: "/path/to/worktree" }) ``` **Do NOT use `cd` in commands** — it doesn't persist and the plugin handles @@ -106,23 +106,23 @@ If blocked → Safe Exit (see below) **File paths:** Always relative to worktree root -- ✅ `src/graphs/mod.ts` +- ✅ `src/transport.rs` - ❌ Absolute paths to the main repo (outside your worktree) ### 4. Self-Verify ```bash -# Type check -deno check mod.ts src/graphs/mod.ts src/sqlite/mod.ts +# Build +cargo build # Lint -deno lint +cargo clippy -- -D warnings # Run tests -deno test --allow-all test/ +cargo test # Format check -deno fmt --check +cargo fmt --check ``` Check each acceptance criterion in the task file. @@ -205,23 +205,20 @@ When available, use memory tools to manage your context: This is especially important for complex tasks that span many file operations. -## Project Conventions (@alkdev/storage) +## Project Conventions Read `AGENTS.md` at project root for full details. Key rules: 1. **No comments in code** — Per project convention. -2. **TypeBox, not Zod** — Use `@alkdev/typebox` and `@alkdev/drizzlebox` for - schema/validation. -3. **Explicit .ts extensions** — All imports must include the `.ts` extension - (Deno convention). -4. **JSR slow types** — Drizzle's deeply inferred generics make explicit - annotations impractical. Use `--allow-slow-types`. Do not annotate drizzle - table definitions. -5. **Injectable clients** — `createSqliteDatabase(client)` takes a client, not - env vars. No module-level side effects. -6. **Naming conventions** — TypeBox schemas: PascalCase (`NodeType`). Drizzle - tables: camelCase (`graphTypes`). Drizzlebox schemas: PascalCase - (`InsertGraph`). +2. **Error handling** — Use `anyhow::Result` for application code, `thiserror` for + library error types. Never panic in library code. +3. **Feature flags** — Transports are feature-gated (`tls`, `iroh`, `acme`). Base + crate should compile lean. +4. **Async runtime** — `tokio` is the async runtime. All I/O is async. +5. **Naming conventions** — Rust standard: `snake_case` for functions/variables/ + modules, `PascalCase` for types/traits, `SCREAMING_SNAKE_CASE` for constants. +6. **Module structure** — One module per component under `src/`. Re-export via + `mod.rs` or `lib.rs` as appropriate. ## Key Principles diff --git a/.opencode/agents/poc-specialist.md b/.opencode/agents/poc-specialist.md index b378e7f..f5fae5f 100644 --- a/.opencode/agents/poc-specialist.md +++ b/.opencode/agents/poc-specialist.md @@ -57,7 +57,7 @@ specifying workdir: ```bash # ✅ CORRECT — workdir is auto-injected -deno test --allow-all test/ +cargo test ``` **Do NOT use `cd` in commands** — it doesn't persist and the plugin handles