agentleFS
agentic-os-orgagentic-os-org/ANOLISA/AGENTS.md

ANOLISA

AGENTS.md660 starsChanged 4 months agoApache-2.0View on GitHub

This file provides context for AI coding assistants (Qoder, Claude, etc.) working in this repository. For a directory-by-directory map, see Repository layout (中文). Start here for contribution rules, then follow the component paths below to any scoped AGENTS.md. Source location and component identity are separate: directory moves must preserve package names, release tags, and existing build and test entry points. ANOLISA is a monorepo for an Agentic OS — a server-side operating layer designed for AI agent workloads. agent-sec-core, agent-memory,…

  • Installs packages
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

37 rules. About 0 are common, 25 are distinctive, and 12 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈25

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 12

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Follow the Rust API Guidelines and the official style guide.

    line 136
  2. Very specific:

    Do not pile /// on private, self-explanatory helper functions.

    line 143
  3. Distinctive:

    Document invariants, preconditions, side effects, and protocol contracts.

    line 150
  4. Distinctive:

    Never repeat facts already obvious from the signature, type, or naming.

    line 151
  5. Distinctive:

    If one line suffices, do not write two.

    line 155
  6. Distinctive:

    Avoid polite filler: no "This function returns …".

    line 156
  7. Very specific:

    No bare TODO without owner and context.

    line 168
  8. Distinctive:

    No commented-out old code — use git history.

    line 169
  9. Distinctive:

    No timestamps, author names, or changelog-style comments — VCS handles that.

    line 170
  10. Distinctive:

    No restating the type signature in comments.

    line 172
  11. Very specific:

    Use the Rust 2018+ recommended layout: parent modules are .rs files with matching directories for child modules.

    line 176
  12. Very specific:

    All third-party dependencies declare their version in [workspace.dependencies].

    line 184
  13. Very specific:

    Before adding a dependency, grep Cargo.toml to check whether an equivalent crate already exists (e.g.

    line 185
  14. Distinctive:

    Do not bump a declared dependency's major version without discussion.

    line 186
  15. Very specific:

    Prefer ? propagation; do not rewrite ?-eligible code with match + immediate return Err(...).

    line 195
  16. Distinctive:

    Every Rust component must pass these before committing:

    line 199
  17. Distinctive:

    Never comment out tests or remove assertions to pass checks — find and fix the root cause.

    line 209
  18. Distinctive:

    Do not restate the diff line-by-line or paste design docs.

    line 254
  19. Very specific:

    When generating commits, detect the active tool and fill in the actual version.

    line 282
  20. Distinctive:

    Every commit in a PR must compile independently

    line 288
  21. Distinctive:

    Multi-component changes: use the scope covering the most changed files.

    line 313
  22. Very specific:

    Use .github/pull_request_template.md as the base template.

    line 340
  23. Distinctive:

    All code and comments must be in English

    line 359
  24. Distinctive:

    Do not hide errors or risks — make them visible and actionable

    line 360
  25. Distinctive:

    Every change should not only implement the desired functionality but also improve codebase quality

    line 361
  26. Distinctive:

    Every fix commit must be attributed correctly:

    line 390
  27. Distinctive:

    Never: create a standalone "fix" commit for something introduced earlier in the same PR branch.

    line 399
  28. Very specific:

    Use chore(<scope>): bump version to X.Y.Z (not release(...) — commitlint rejects non-standard types).

    line 403
  29. Very specific:

    All version-bearing files for the component must be updated atomically.

    line 405
  30. Distinctive:

    Verify the claim: Read the actual code at the cited line.

    line 422
  31. Distinctive:

    Assess severity: Only P0 (security) and P1 (correctness) warrant immediate code changes.

    line 423
  32. Very specific:

    Check if pre-existing: If the issue existed before this PR, it needs Fixes: attribution to the original commit.

    line 424
  33. Distinctive:

    When replying to review findings:

    line 428
  34. Distinctive:

    Never blindly accept and fix every AI finding.

    line 434
  35. Very specific:

    Every inline review comment MUST receive exactly one thread reply via in_reply_to.

    line 438
  36. Distinctive:

    Never duplicate replies on already-answered threads.

    line 441
  37. Distinctive:

    Before replying, query the API to identify which comments lack a response — avoid both omissions and repetition.

    line 442

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

This file provides context for AI coding assistants (Qoder, Claude, etc.) working in this repository.

For a directory-by-directory map, see Repository layout (中文). Start here for contribution rules, then follow the component paths below to any scoped AGENTS.md. Source location and component identity are separate: directory moves must preserve package names, release tags, and existing build and test entry points.

1. Project Overview

ANOLISA is a monorepo for an Agentic OS — a server-side operating layer designed for AI agent workloads.

ComponentPathTechPlatform
copilot-shell (cosh)deprecated/copilot-shell/TypeScript / Node.jsAll
cosh-ngsrc/cosh-ng/RustLinux (full); macOS (limited functionality)
agent-sec-coresrc/agent-sec-core/Rust + PythonLinux only
agentsightsrc/agentsight/Rust (eBPF)Linux (full); macOS (trajectory/serve only)
tokenlesssrc/tokenless/RustLinux (full); macOS x64/arm64 (CLI binaries + adapters, via npm)
agent-memory (memory)src/agent-memory/RustLinux only
os-skillssrc/os-skills/Python / ShellAll
anolisadistribution/anolisa/RustLinux + macOS (arm64)
SkillFS (skillfs)src/skillfs/Rust / FUSELinux only
ws-ckptsrc/ws-ckpt/Rust + TypeScriptLinux only
ktunersrc/ktuner/RustLinux only
blazesrc/blaze/RustLinux only
awsrc/aw/RustLinux only

agent-sec-core, agent-memory, skillfs, ktuner, blaze, and aw require Linux. agentsight provides full eBPF tracing on Linux and limited trajectory collection plus the local viewer on macOS. cosh-ng is Linux-first and supports limited functionality on macOS. Do not attempt to build the Linux-only components on macOS or Windows. (tokenless ships macOS CLI binaries and framework adapters via npm, but the binaries are cross-compiled from Linux — building tokenless on macOS is still unsupported.)

2. Development Commands

# Unified build (recommended — handles deps, build, and user install)
./scripts/build-all.sh                                        # integrated default components
./scripts/build-all.sh --no-install                           # build only, skip install
./scripts/build-all.sh --ignore-deps                          # skip dependency setup and runtime verification
./scripts/build-all.sh --component cosh --component sec-core  # selected components

# Partial convenience test runner (five components; may skip unavailable suites)
./tests/run-all-tests.sh
./tests/run-all-tests.sh --filter shell   # copilot-shell only
./tests/run-all-tests.sh --filter sec     # agent-sec-core only
./tests/run-all-tests.sh --filter sight   # agentsight only

# copilot-shell (per-component)
cd deprecated/copilot-shell
make deps      # npm install + husky hooks (use make deps-ci in CI)
make build
make lint
make test

# cosh-ng (Linux full; macOS limited functionality, per-component)
cd src/cosh-ng
cargo build --workspace
cargo fmt --all -- --check
# Select the closest targeted test from src/cosh-ng/CONTRIBUTING.md.
# Full gates require a large/cross-cutting change and an explicit request.

# agent-sec-core (Linux only; Python 3.11.6 + uv, per-component)
cd src/agent-sec-core
make build-all
uv run --project agent-sec-cli python --version  # must report 3.11.6
make test         # Python + Rust sandbox + OpenClaw plugin tests

# agentsight (Linux full eBPF; macOS trajectory/serve only, per-component)
cd src/agentsight
# Linux
make build-all
make lint
make test

# macOS
make build-mac

# os-skills
cd src/os-skills   # Skill definitions are static assets, no compilation needed

# tokenless (per-component)
cd src/tokenless
make build       # tokenless + RTK + OpenClaw plugin
make lint
make test        # Rust + hooks + integration + adapters

# agent-memory (Linux only, per-component)
cd src/agent-memory
make build       # cargo build --release --locked
make fmt-check
make lint
make test        # cargo test --locked
make smoke       # end-to-end MCP stdio smoke test

# anolisa (per-component)
cd distribution/anolisa
cargo fmt --all --check
cargo clippy --all-targets --locked -- -D warnings
cargo test --locked

# ws-ckpt (Linux only, per-component)
cd src/ws-ckpt
make build       # cargo build --release + openclaw plugin
make test        # cargo test --workspace

# SkillFS (Linux only, per-component)
cd src/skillfs
cargo fmt --all --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
scripts/test.sh   # FUSE smoke test; skips itself if fuse3 or /dev/fuse is unavailable

# ktuner (Linux only, per-component)
cd src/ktuner
cargo fmt --all --check
cargo clippy --all-targets -- -D warnings
cargo test

# blaze (Linux only, per-component)
cd src/blaze
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace

# aw (Linux only, per-component; toolchain pinned by src/aw/rust-toolchain.toml)
python3 src/aw/scripts/check.py   # from the repository root: CI behavior tests,
                                  # fmt, clippy, locked tests, digest vectors, rustdoc

3. Rust Common Conventions

Applies to these Rust components: anolisa, agentsight, tokenless, agent-memory, skillfs, ktuner, blaze, aw.

3.1 Comment Guidelines

Follow the Rust API Guidelines and the official style guide. Write comments that help readers understand intent faster — not comments that paraphrase code.

Comment types and placement:

  • //! module-level docs: at the top of a file/module — one or two sentences describing what the module does and when to use it.
  • /// doc comments: required on all public (pub) items — structs, enums, traits, functions, methods, significant fields, and variants. These appear in cargo doc.
  • // inline comments: only where the implementation needs to explain why something is done a certain way.
  • Do not pile /// on private, self-explanatory helper functions.

Write "why", not "what":

  • Type names, field names, and function names already say what; comments should explain why and document invariants.
    • Good: // Serialize as untagged because most providers omit the type field
    • Bad: // This is an enum representing assistant content
  • Document invariants, preconditions, side effects, and protocol contracts.
  • Never repeat facts already obvious from the signature, type, or naming.

Brevity first:

  • If one line suffices, do not write two. Trivial setters need no comment or at most a single sentence.
  • Avoid polite filler: no "This function returns …". Start with an imperative or noun phrase: "Returns …", "Builds …".
  • First line is a standalone summary; expand after a blank line if needed.

Conventional rustdoc sections (use when they add value):

  • # Errors — for functions returning Result: list failure conditions.
  • # Panics — for functions that can panic: list trigger conditions.
  • # Safety — for unsafe fn: state invariants the caller must uphold.
  • # Examples — typical usage in ```rust blocks, runnable by cargo test --doc.

Prohibited patterns:

  • No bare TODO without owner and context.
  • No commented-out old code — use git history.
  • No timestamps, author names, or changelog-style comments — VCS handles that.
  • No "fixes issue #123" in comments — put that in the PR description.
  • No restating the type signature in comments.

3.2 Module Organization: no mod.rs

Use the Rust 2018+ recommended layout: parent modules are .rs files with matching directories for child modules. Never create a mod.rs; flag any encountered during code review.

Rationale: avoids identically-named mod.rs files; makes editor tabs more readable; aligns with rustfmt and cargo new defaults.

Exception: tests/common/mod.rs — cargo's official convention for sharing helpers across integration tests.

3.3 Dependency Management

  • All third-party dependencies declare their version in [workspace.dependencies]; crates reference them via dep_name = { workspace = true } — never pin versions in sub-crates.
  • Before adding a dependency, grep Cargo.toml to check whether an equivalent crate already exists (e.g. do not add simd-json when serde_json is already present).
  • Do not bump a declared dependency's major version without discussion.
  • Feature flags are enabled centrally in the workspace declaration; sub-crates should not repeat features = [...] unless genuinely extending them.

3.4 Error Handling

  • Library crates: define named enum error types with thiserror. Each crate owns its error enum and wraps upstream errors via #[from] — do not reuse error enums across crate boundaries.
  • Binaries: may use anyhow::Result for ergonomic error propagation.
  • Library code must not use unwrap() / expect() / panic!() unless a comment proves the condition is guaranteed unreachable by the type system (prefer unreachable!() with an explanation).
  • Error messages target developers: include failure context and relevant variable values; avoid "something went wrong" style messages.
  • Prefer ? propagation; do not rewrite ?-eligible code with match + immediate return Err(...).

3.5 Pre-commit Checks

Every Rust component must pass these before committing:

cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
cargo doc --workspace --no-deps   # required when changing public API or doc comments
  • Clippy warnings are denied by default. To allow a specific lint, use #[allow(clippy::xxx)] at the narrowest scope with a comment explaining why.
  • Never comment out tests or remove assertions to pass checks — find and fix the root cause.

4. Python Conventions

Detailed Python standards are in src/agent-sec-core/AGENTS.md.

Summary:

  • Version: Python 3.11.6 (pinned)
  • Package manager: uv
  • Formatting: black + isort (line-length = 100)
  • Linting: ruff (F, E, W, I, TID252, ANN, S-subset, etc.)
  • Type annotations: required on all function parameters and return types
  • Imports: absolute only (from agent_sec_cli.xxx import yyy); no relative imports
  • Testing: pytest; tests live in tests/ not inside package directories

5. TypeScript Conventions

Detailed config in deprecated/copilot-shell/.

  • Linting: ESLint
  • Formatting: Prettier
  • Build: make build (npm-based)
  • Test: make test

6. Commit Message Rules

scope is mandatory — CI will error if scope is missing.

Subject line

Format: type(scope): imperative description

  • Repository maximum: 50 characters (commitlint currently hard-fails above 120)
  • Language: English only
  • Imperative mood ("add", "fix", "remove" — not "added", "fixes", "removing")
  • Lowercase first letter, no trailing period
  • Breaking changes: append ! before colon, e.g. feat(cosh)!: remove legacy flag

Body (when non-trivial)

Separated from subject by a blank line. Cover three things:

  1. What architectural choice was made
  2. Why this approach over alternatives
  3. Known limitations or trade-offs

Do not restate the diff line-by-line or paste design docs.

Trailers

Assisted-by: <tool>:<version>
Signed-off-by: Name <email>

Assisted-by goes above Signed-off-by. Omit Assisted-by if no AI was involved.

git commit \
  --trailer "Assisted-by: Qoder:1.7.0" \
  --trailer "Signed-off-by: $(git config user.name) <$(git config user.email)>" \
  -m '...'

Tool identifier detection:

Detection methodTool identifier
$QODER_VERSION env varQoder:<ver>
$CLAUDE_CODE_VERSION env varClaude Code:<ver>
Parent process is Qoder.app / QoderWork.appRead CFBundleShortVersionString from app bundle
Parent process is Claude.appClaude:<ver>
Parent process is Cursor.appCursor:<ver>

When generating commits, detect the active tool and fill in the actual version. Do not hardcode a fixed string like Qoder:latest.

Atomicity

  • One commit = one logical change
  • Scope must match the actual files changed
  • Every commit in a PR must compile independently
  • Squash fixup commits before merge

Scope Inference (by changed file path)

Changed pathScope
deprecated/copilot-shell/cosh
src/cosh-ng/cosh-ng
src/agent-sec-core/sec-core
src/os-skills/skill
src/agentsight/sight
src/tokenless/tokenless
src/ws-ckpt/ckpt
src/agent-memory/memory
distribution/anolisa/anolisa
src/skillfs/skillfs
src/ktuner/ktuner
src/blaze/blaze
src/aw/aw
.github/workflows/ci
docs/docs
**/package*.json, Cargo.lock, *.toml (dep bumps)deps
Other root-level config / scripts / toolingchore

Multi-component changes: use the scope covering the most changed files.

Examples

feat(cosh): add --json flag to config command

Scripts need machine-readable config output; chose flat JSON over
nested to keep parsing trivial. Nested config support tracked in #55.

Assisted-by: Qoder
Signed-off-by: Zhang San <zhangsan@example.com>

7. Branch Naming

Recommended convention — not enforced for fork contributors.

feature/<scope>/<short-desc>    e.g. feature/cosh/json-output
fix/<scope>/<short-desc>        e.g. fix/sec-core/sandbox-escape
hotfix/<scope>/<short-desc>     e.g. hotfix/skill/broken-load
release/<scope>/vX.Y            e.g. release/cosh/v2.1

8. PR Description

Use .github/pull_request_template.md as the base template. Key rules:

  • Description: 2–5 sentences — what changed, why, key implementation decision
  • Related Issue: closes #<n> or no-issue: <reason>
  • Risk and compatibility: explain checked public, privileged, contract, or migration risks
  • Validation: commands, environment, scope (unit/integration/manual), and edge cases
  • Documentation and rollback: record documentation updates and rollback guidance
  • PR title follows commit message format: type(scope): description

9. Documentation Rules

MANDATORY: All documentation rules — file naming, bilingual conventions, CHANGELOG format, file placement, user-guide standards — are defined in specs/documentation-standard.md. You MUST read that file before creating, renaming, or modifying any documentation file. Non-compliance will be rejected in review.

MANDATORY: When introducing a new src/<name>/ component, you MUST read and follow specs/component-onboarding.md before opening the scaffold PR.

This section intentionally does not duplicate the spec. Do NOT invent documentation rules from memory or prior context — the spec is the single source of truth.

10. Code Standards (General)

  • All code and comments must be in English
  • Do not hide errors or risks — make them visible and actionable
  • Every change should not only implement the desired functionality but also improve codebase quality

11. Scoped Module Rules

Components with complex architectures maintain their own AGENTS.md for module-specific conventions. Read the relevant scoped file before contributing to that component.

ComponentScoped RulesFocus
agentsightsrc/agentsight/AGENTS.mdeBPF probes, data pipeline architecture, module map, FFI constraints, API endpoints
agent-sec-coresrc/agent-sec-core/AGENTS.mdPython environment, ruff/black rules, hermes-plugin, capability system
anolisadistribution/anolisa/AGENTS.mdWorkspace structure, crate responsibilities
cosh-ngsrc/cosh-ng/AGENTS.md5-crate workspace, security heuristics, PTY testing strategy
skillfssrc/skillfs/AGENTS.mdThree-crate layout, dependency exceptions, FUSE e2e testing
blazesrc/blaze/AGENTS.mdTwo-crate workspace, sandbox backends, daemon lifecycle

11.1 File Placement & Documentation Structure

MANDATORY: See specs/documentation-standard.md §2–§4 for the complete file placement rules, bilingual naming convention, and component-level file requirements. Do NOT rely on cached or memorized rules — read the spec file directly.

12. User Guide Documentation Standards

MANDATORY: See specs/documentation-standard.md §4.6 for user-guide writing standards including installation priority, content boundaries, framing principles, and bilingual language rules. You MUST comply — skipping this spec and writing docs from assumptions is a blocking review issue.


13. Commit Discipline

Fix attribution rule

Every fix commit must be attributed correctly:

SituationAction
Bug introduced by a commit in this PRgit commit --fixup=<hash> then rebase --autosquash. No separate commit.
Bug introduced by a commit already on mainStandalone commit with Fixes: <hash> ("<subject>") in body.
Enhancement supplementing a feature already on mainStandalone commit with Supplements: <hash> ("<subject>") in body.
Brand-new feature or unrelated changeStandalone commit, no Fixes/Supplements needed.

Never create a standalone "fix" commit for something introduced earlier in the same PR branch. Always amend or fixup into the originating commit.

Version bump rule

  • Use chore(<scope>): bump version to X.Y.Z (not release(...) — commitlint rejects non-standard types).
  • Version bump is always the last commit in a feature branch.
  • All version-bearing files for the component must be updated atomically. This includes whichever of the following exist: Cargo.toml or package.json, .anolisa/component.toml, manifests/<name>.toml, dist/<name>.spec, and CHANGELOG.md.
  • CHANGELOG.md (and its _zh counterpart) is edited only in the version bump commit. Feature, fix, docs and test commits must not touch it, even when the change is user-visible — the entry is written when the version is cut, together with the other version-bearing files. Do not add a changelog line to a feature PR and expect the bump to merge it.

Format check

Run the component's applicable formatter before every commit (e.g. cargo fmt --all for Rust from the workspace root, npm run format for TypeScript, make python-code-pretty for Python). CI will reject formatting diffs. If a rebase introduces format changes, amend them into the commit that caused the change — do not create a standalone "style" commit.


14. Responding to Review

Recommended: Reviewer-side methodology — deeper self-review checklists beyond CI gates — is defined in specs/independent-review-guide.md. This section covers the author side: triaging and responding to findings.

Triage before acting

AI reviewers (qoderai, qoder) generate findings automatically. Before fixing:

  1. Verify the claim: Read the actual code at the cited line. AI reviewers hallucinate — they may reference wrong line numbers, misread logic, or flag non-issues.
  2. Assess severity: Only P0 (security) and P1 (correctness) warrant immediate code changes. P2 (style/docs) can be batched. P3+ can be deferred.
  3. Check if pre-existing: If the issue existed before this PR, it needs Fixes: attribution to the original commit. If it's a design limitation (not a bug), reply with rationale rather than patching.

Response format

When replying to review findings:

  • Fixed: State what was done and which commit it landed in.
  • Deferred: Explain why it's out of scope for this PR and what the plan is.
  • Not a real issue: Explain why the finding is incorrect or not applicable. Cite specific code/design rationale.

Never blindly accept and fix every AI finding. Some are false positives, some are architectural suggestions that require design discussion.

Inline reply discipline

  • Every inline review comment MUST receive exactly one thread reply via in_reply_to.
  • Reply at the same time as the code fix push — never push silently.
  • For stale comments resolved by a newer revision: reply "Resolved in latest revision" (one sentence).
  • Never duplicate replies on already-answered threads.
  • Before replying, query the API to identify which comments lack a response — avoid both omissions and repetition.

Common false positive patterns

  • "X is not tested" when X has a default impl that returns Err (intentional no-op)
  • "Missing error handling" when the ? operator already propagates
  • "Config field unused" when it's reserved for a future phase
  • "Version mismatch" referencing stale file contents from a previous push

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.