Operating guide for AI coding agents (and humans) working in this repository. Read this first; follow links only when the task needs them.
A local-first, cross-platform storage intelligence platform (macOS, Windows, Android,
iOS, web dashboard). A Rust core scans devices, collects evidence, builds an evidence
graph, and a deterministic safety policy decides KEEP / REVIEW / QUARANTINE.
An optional AI judge (Jev) contributes evidence only. Cleanup is reversible
(quarantine → verify → retain → finalize or roll back).
Safety of user data outranks reclaimed space. When uncertain: KEEP or REVIEW,
never remove.
| Need | Go to |
|---|---|
| System overview, crate layers, domain model | docs/architecture/system.md |
| What each platform can and cannot do | docs/architecture/platforms.md |
| What to build next | docs/architecture/roadmap.md |
| Scanner safety contract | docs/architecture/scanner.md |
| Evidence, graph, bundles and hashes | docs/architecture/evidence-graph.md |
| Scanner performance baselines | docs/architecture/performance.md |
| Why a decision was made | docs/decisions/ (ADRs) |
| Evidence behind decisions | docs/research/ |
| Threats and controls | docs/security/threat-model.md |
| Jev (AI) contract, safety, evaluation | docs/ai/ |
| UI and UX principles (desktop, mobile, website) | docs/design/ui-principles.md |
| UX writing: tone, Korean 해요체 rules, Lumen's words | docs/design/ux-writing.md |
| Rules for one directory (read before editing there) | its AGENTS.md: lumen-fs-exec, lumen-policy, lumen-jev, apps/desktop, apps/web, .github |
Do not load the whole repository into context. Search, read the relevant ADR and the files you will touch, trace dependencies, inspect tests, then change.
- Discover:
git status, current branch, open PRs (gh pr list), the roadmap item. - Understand: read the relevant ADRs and code. Search official documentation when
an API, version or platform rule matters; record important findings in
docs/research/or an ADR. - Plan the smallest change that is one logical unit. If it would exceed about 400 changed lines of non-generated code, or mixes concerns: stop and split.
- Implement on a branch named
<type>/<short-slug>from an up-to-datedevelop. - Verify proportionally. CI checks every PR: format, clippy, all tests on
Linux, macOS and Windows, doc tests, MSRV, the Android and iOS builds,
cargo-deny and OSV-Scanner, schema drift, crate layering and doc links
(
cargo xtask lint), the Jev cassette replay, and the JavaScript workspace's Biome, typecheck, tests and builds. Locally, run targeted tests and required checks for the changed behavior; do not run the fulljust checkor duplicate broad CI suites. Also run what CI does not:- code generation whose output is committed (
just gen); - benchmarks before and after a performance change;
- the app itself, to see a UI change;
- anything that needs hardware, an OS or a service CI lacks. Do not rely on CI alone for compile errors, clear regressions or security-critical behavior. When CI fails, fix the root cause; never weaken a check. Do not declare work complete until required CI checks pass.
- code generation whose output is committed (
- Commit one Conventional Commit (
type(scope): summary). - PR:
gh pr createwith the template sections (Summary, Why, Changes, Tests, Security, Risks, Follow-up). - CI green → merge into
develop(gh pr merge --squash --delete-branch), thengit checkout develop && git pull --ff-only. - Continue with the next atomic change.
Optimize for minimum wall-clock time and efficient token usage without compromising correctness or safety.
- Before starting, map task dependencies and identify independent investigation, implementation, test-writing and review work. Run independent work in parallel when it shortens the critical path. Use agents for independent substantial work when available and worthwhile. For substantial tasks, start with 2–4 independent work streams and adjust to task size and environment; do not parallelize simple work or split tasks merely to use more agents.
- When using agents, assign each a bounded objective, clear completion criteria and exclusive file ownership. Prefer separate Git worktrees for independent code changes; avoid concurrent edits to the same files and integrate changes deliberately to prevent conflicts and rework.
- Keep context and token use lean: share only the relevant files, constraints and expected output; avoid repeated searches, reads, investigations, test runs and duplicate agent work. Choose sequential work when coordination or context cost outweighs parallelism.
- Run focused local tests and essential checks once per relevant change. Let CI handle broad suites, Clippy, formatting and cross-platform builds. While CI or agents are running, continue independent work; inspect failures promptly and fix only their root cause. Confirm all required CI checks pass before declaring completion or merging.
- Separate independent changes into separate PRs where practical and run their CI concurrently. Before merging, check dependencies, conflicts and that the branch is current; follow this repository's branch protection and merge rules.
- Never trade away required tests or security checks for speed. Scale verification to the change's risk, and use sequential execution whenever parallel work could reduce correctness or safety. Preserve Lumen's data-safety rules above all.
Releasing (ADR-0054): every
push to main publishes the version it names to every installed copy, with no
approval step. Only when the owner asks for a release: raise the version on develop
in its own PR, then open a PR from develop into main and merge it with a merge
commit (gh pr merge --merge). Never push or merge into main otherwise. Steps:
docs/operations/release.md.
One-time setup per clone: install rustup, cargo-nextest, cargo-deny, just,
lefthook, gitleaks and Node.js 24 (then corepack enable), then run
lefthook install. CI runs the same checks
plus OSV-Scanner, CodeQL, zizmor, actionlint, the MSRV build and the PR-title check.
- Never write code that deletes, moves or overwrites user files outside
crates/lumen-fs-exec. Destructivestd::fsAPIs are banned elsewhere by clippy. - Never act on a path string resolved after verification; act by handle with identity checks (ADR-0016).
- Never treat unreadable or unscanned as empty or absent (ADR-0008).
- Never auto-remove: system files, OS components, unknown application data, user documents, credentials and keys, browser profiles, databases, application state, security software, unknown launch agents or services, files in use, or cloud placeholders.
- Never hydrate cloud placeholders, open archives, or read file contents during scanning.
- Destructive tests run only in temporary fixture directories, never on the real filesystem.
- AI output is evidence. It never selects actions, paths or commands, and by default it can only make a decision more cautious (ADR-0020).
- Never send file contents to any model. Cloud AI is metadata-only, and sends nothing until the user chooses it; the app asks once on first launch, and the choice can be changed in Settings (ADR-0050).
- Never parse free-form model text as instructions.
- One logical change = one commit = one PR. No unrelated changes in a PR.
- Never use
--no-verify, never bypass or disable checks, never force-pushmainordevelop, never merge with failing checks. - Never add
Co-Authored-Byor any AI attribution trailer. Use the repository's configured Git identity; never change it. - Fixes to merged work go in a new commit and a new PR.
- Rust: edition 2024,
thiserrorerrors with context (anyhowonly in binaries), no silently ignoredResults, nounwrap/expectin library code,unsafeonly with a// SAFETY:comment stating the invariant, whyunsafeis needed, and why the invariant holds. Bounded concurrency and cancellation for long operations. - Domain, policy and graph crates stay IO-free and platform-free; no
#[cfg(target_os)]there. - TypeScript: strict; no
any;asonly at validated boundaries; Zod at untrusted edges; exhaustive switches; branded IDs; nativefetch, never axios. - Every new dependency needs a reason in the PR (alternatives considered, maintenance, license, security history, size). Prefer the standard library and platform APIs.
- Documentation is part of the change: update the ADR index, architecture docs or crate docs that your change makes stale.
- If a request conflicts with platform security, user-data safety, an accepted ADR or current official documentation, do not silently comply. Explain the conflict and propose an alternative, or write a superseding ADR.
- If two approaches are plausible: research, compare, document the trade-off, then choose.
- Low confidence: choose the safer, reversible option and say so. Do not manufacture confidence.