This file provides guidance to Claude Code when working in this repository. AGENTS.md remains the authoritative rule source; keep this file aligned with it.
- Reply to users in Chinese.
- Prefix every user-facing reply with
[I strictly follow the rules].
Agent Diva is a Rust workspace for a modular AI assistant system spanning agent runtime, provider integrations, channels, tooling, local gateway, GUI, AutoDream, Laputa memory/proposal services, and sandbox policy enforcement.
Primary crates:
agent-diva-core: shared config, memory/session, cron, heartbeat, event bus foundationsagent-diva-agent: agent loop, context assembly, skill/subagent flowagent-diva-providers: LLM/transcription provider abstractions and implementationsagent-diva-channels: channel adaptersagent-diva-tools: built-in toolsagent-diva-files: file indexing and file-management helpersagent-diva-tooling: shared tooling abstractions/utilitiesagent-diva-neuron: supporting types/helpers used by the GUIagent-diva-manager: default local gateway and HTTP control plane foragent-diva-cliagent-diva-autodream: AutoDream manual-run, proposal, input, and output lifecycle supportagent-diva-laputa: proposal, migration, recovery, and memory-provider servicesagent-diva-sandbox: sandbox policy, execution, platform adapters, approval/guardian supportagent-diva-cli: user-facing CLI entrypointagent-diva-service: Windows service wrapperagent-diva-gui: optional Tauri desktop appagent-diva-migration: migration utility from earlier versions
Nested/reference workspace:
agent-diva-nano: lives under.workspace/agent-diva-nano/; it is not a root workspace member
Additional repository facts:
- Root workspace package version:
0.5.0 - Rust MSRV:
1.80.0 - Main branch in this checkout:
agent-diva-pro .workspace/contains sibling reference projects such asopenfang,zeroclaw,nanobot, andcodex- Embedded Laputa typed SQLite is the sole production Memory authority; legacy backends are offline import sources only
- Keep cross-cutting domain types in
agent-diva-core. - Keep provider/channel-specific logic isolated in dedicated crates.
- Prefer small modules and composable functions over large files.
- Avoid
unwrap/expectin non-test code; propagate errors with context. - Keep async boundaries explicit and avoid blocking in async paths.
- Preserve backward compatibility for public interfaces unless a breaking change is intentional and documented.
- When users reference
openclaw,nanobot,shannon, or similar projects, inspect.workspace/first and adapt ideas to Agent Diva architecture.
Prefer just from the workspace root:
just build
just build-release
just test
just check
just fmt
just fmt-check
just ci
just memory-provider-check
just laputa-clean-break-check
just cognitive-clean-break-check
just run -- <args>
just migrate -- <args>Useful direct cargo commands:
cargo test -p <crate>
cargo test <test_name>
cargo run -p agent-diva-cli -- <args>- Default post-change validation is
just fmt-check,just check,just test. - If a change does not justify one of those commands, explain why.
- For user-visible or executable behavior changes, run at least one smoke path in addition to tests.
- If modifying
agent-diva-gui, include GUI-specific smoke validation. - Record validation results in iteration logs under
docs/logs/.../verification.md.
AGENTS.md: authoritative repository rulesCLAUDE.md: Claude-oriented mirror of operational guidance; keep aligned withAGENTS.mdTODOLIST.md: canonical backlog for discovered bugs, gaps, and deferred workLOCK.md: canonical mutex file for parallel Codex/Cursor/manual sessions
- If the user says the project is in a parallel state, do not continue development in the shared root working tree.
- Move work into an isolated branch/worktree or copied sibling workspace before editing.
- Before any write task or workspace-mutating command, read
LOCK.md. - If
LOCK.mdshows an active overlapping scope, do not edit in that scope until the lock is released, handed off, or you move to a non-overlapping isolated workspace. - Every parallel write task must update
LOCK.mdwith owner, session/task, branch/worktree, exact scope, heartbeat, and expiry. GLOBALscope is reserved for migrations, bulk formatting, or broad refactors.
Each deliverable change must create a new versioned directory under docs/logs/<theme>/v0.0.1-slug/ containing:
summary.mdverification.mdrelease.mdacceptance.md
Optional files such as notes.md, prd.md, or rollback.md may be added when needed.
- Add discovered bugs, unfinished work, known limitations, or deferred improvements to
TODOLIST.mdunless fixed in the same iteration. - Entries should contain status, short title, reason/context, expected behavior, and related files/docs when available.
- Completed items should be moved or marked under
Done, not silently deleted.
- Use English Conventional Commit prefixes such as
feat:,fix:,docs:. - Create one commit per completed, self-contained update.
- Do not push unless the user explicitly asks.
- Stage only files for the current focused update; do not include unrelated pre-existing workspace changes.
- Clean up scratch artifacts created during the task before committing.
- For non-trivial commits, include validation notes in the commit body or accompanying report.
Agreed meta-commands:
/new-command/config-meta/check-meta/new-rule/commit/validate/init
If commands are added or modified, update both the command index in AGENTS.md and commands/commands.md when that file exists or is first created.
When calling a provider's native OpenAI-compatible endpoint such as DeepSeek https://api.deepseek.com/v1:
- send the raw provider model ID such as
deepseek-chat- do not auto-rewrite it into gateway form such as
deepseek/deepseek-chat - only apply
provider/modelrewriting for a true OpenAI-compatible gateway or aggregator
- do not auto-rewrite it into gateway form such as
Any provider-routing change should add or update tests that assert the final outbound model value.
- Write focused unit tests near the code with
#[cfg(test)]. - Add integration tests under crate
tests/directories for cross-module behavior. - Cover success paths and representative failure paths.
- Validate serialization/config parsing for new config fields.
- Prefer deterministic tests; avoid external network access in tests.
- Use timeout-aware assertions for async behavior to avoid hanging CI.
- Never commit real secrets or tokens.
- Redact sensitive fields in logs, errors, snapshots, and fixtures.
- Prefer least-privilege defaults for tools/channels that execute external actions.
- Use structured, actionable errors with preserved source context.
- Emit logs at appropriate levels and avoid noisy hot-path logging.
- Include useful identifiers without leaking private data.
- The workspace may already be dirty from parallel stories; preserve unrelated changes.
- Do not revert user changes unless explicitly instructed.
- When updating process docs, also update
TODOLIST.mdanddocs/logs. - If
AGENTS.mdandCLAUDE.mddiverge, alignCLAUDE.mdtoAGENTS.mdand state thatAGENTS.mdis authoritative.