agentleFS
hua0512hua0512/rust-srec/AGENTS.md

rust-srec

AGENTS.md121 starsChanged 8 days agoApache-2.0View on GitHub

This file and the AGENTS.md files governing the area being changed define project conventions, subject to higher-priority instructions and the user's task scope. Read the applicable rules when entering an area; reuse context already read unless it has changed. Tool-specific entrypoints should refer here for shared rules. Use the map below to locate the task. Read supporting docs, examples, and skills only when they answer a concrete question or supply a procedure needed for the work. A link is a…

  • Installs packages
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 35,040 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.

  • In this repository4 other files it gives its agents.

The file

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

9 rules. About 0 are common, 2 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run Rust commands from the repository root.

    line 28
  2. Very specific:

    Use rustfmt defaults and idiomatic names.

    line 77
  3. Very specific:

    Prefer extending an existing module unless the change introduces a separate logical component.

    line 78
  4. Distinctive:

    Do not leak our conversation, prompt, or iteration history into code comments, pull request descriptions, or other maintainer-facing prose.

    line 80
  5. Very specific:

    Prefer explicit types over string-based APIs.

    line 82
  6. Very specific:

    Do not introduce unwrap() / expect() in production paths.

    line 83
  7. Very specific:

    Do not silently discard an unhandled Result.

    line 84
  8. Very specific:

    Use structured tracing fields.

    line 86
  9. Distinctive:

    Remove only clearly disposable temporary artifacts created by this task.

    line 103

≈ “Common” is an estimate: at least 1 in 5 of the 45,344 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

Repository guidance

Scope and reading

This file and the AGENTS.md files governing the area being changed define project conventions, subject to higher-priority instructions and the user's task scope. Read the applicable rules when entering an area; reuse context already read unless it has changed. Tool-specific entrypoints should refer here for shared rules.

Use the map below to locate the task. Read supporting docs, examples, and skills only when they answer a concrete question or supply a procedure needed for the work. A link is a lookup aid, not a requirement to read every referenced file before each edit.

AreaLocation / task-specific guidance
Backend: REST API, recorder, pipeline, SQLiterust-srec/: package rust-srec and the srec-* crates in rust-srec/crates/; backend rules
CLIsstrev-cli/ (package strev), mesio-cli/ (package mesio)
Protocols, containers, platform extractors, download enginecrates/*; crate map and module guide
Web UI and desktop frontendrust-srec/frontend/; frontend rules
Desktop wrapperrust-srec/src-tauri/; desktop rules
Documentation siterust-srec/docs/; docs rules
Application release planning, preparation, or publishingRead the release skill only for a rust-srec release/version task; it is the canonical procedure even if the tool does not discover .claude/skills automatically
Auditing new or existing tests before a PR, or pruning a test suiteRead the test review skill when reviewing test additions before a PR, auditing existing suites, or cutting a suite's size; it is the canonical procedure even if the tool does not discover .claude/skills automatically

Toolchain and command reference

  • Rust edition and minimum supported version: Cargo.toml. Development toolchain and components: rust-toolchain.toml.
  • Node: .nvmrc. pnpm and scripts: frontend package.json and docs package.json. Install dependencies when needed with pnpm install --frozen-lockfile in the relevant directory.
  • Rust code generated from the .proto schemas in rust-srec/proto/ and crates/platforms/proto/ is committed, so builds need no protoc. After editing a schema, regenerate with UPDATE_GENERATED_PROTOS=1 cargo nextest run --locked -p <package> --lib -E 'test(generated_protos)' (srec-api or platforms-parser); without the variable that test fails when the committed code is stale.
  • Held dependencies (nothing enforces these, so reject Dependabot bumps): cc stays at 1.8.0 in Cargo.lock, because 1.9.0 breaks MSVC builds under sccache. parking_lot stays on 0.12 while dependencies such as crossterm, moka, tao and tracing-subscriber use 0.12, because 0.13 would compile a second copy. notify-rust stays on 4.18 while the Tauri plugins use zbus 5, because 4.19 pulls zbus 6. wry stays at 0.57.1 until tauri-utils moves to dom_query 0.29, because 0.57.2 would compile a second HTML parser stack. Frontend version constraints are listed in the frontend rules.
  • Exact CI targets, platform prerequisites, and feature combinations live in .github/workflows/pr.yml. Release build combinations live in the corresponding .github/workflows/release-*.yml files. Consult these when reproducing CI or changing build/release behavior.

Run Rust commands from the repository root. Replace <package> and <test_name> with the affected package and test filter:

cargo build --locked                         # default applications, excludes desktop
cargo build --locked -p <package>
cargo fmt --all -- --check
cargo clippy --locked -p <package> --all-targets -- -D warnings
cargo nextest run --locked -p <package>
cargo nextest run --locked -p <package> -E 'test(<test_name>)'
cargo test --locked -p <package> <test_name>  # fallback if nextest is unavailable
cargo test --locked -p <package> --doc       # when doctests are affected
RUSTDOCFLAGS="-D warnings" cargo doc --locked --workspace --exclude rust-srec-desktop --all-features --no-deps --document-private-items
                                             # CI's Rustdoc job; run when doc comments change or items are renamed

Use cargo fmt --all to apply formatting, and review the diff for unrelated changes. Add --release when release-mode behavior or a release artifact is relevant. Use default features on Windows; do not use --all-features there with the current OpenSSL prerequisites. On Linux, reproduce the specific CI feature selection when it is relevant rather than assuming --all-features is equivalent.

For broader integration checks, use --workspace --exclude rust-srec-desktop in place of -p <package>. Desktop validation is separate because it needs frontend and platform dependencies. Full workspace builds including desktop use cargo build --locked --workspace when those prerequisites and that scope apply.

Run/debug examples:

cargo run --locked -p rust-srec --bin rust-srec
cargo run --locked -p strev -- --help
cargo run --locked -p mesio -- --help

Frontend and docs commands are in their respective AGENTS.md files. CONTRIBUTING.md contains contributor setup and broader local command examples.

Validation by task

Choose checks from the changed behavior and its consumers. These are local validation requirements, not a requirement to reproduce every CI job for every edit.

ChangeLocal validation
Agent rules, prose, spellingReview the diff; verify affected paths, commands, links, and factual claims. No Rust/frontend build or new tests solely for prose changes.
Docs navigation, configuration, or complex MarkdownBuild the docs site and check affected links; preview pages when layout or rendering needs inspection.
Local Rust behaviorFormatting, affected-package Clippy, and focused tests covering the behavior. Add or adjust regression tests where they protect an observable contract; for the backend, follow its testing rules on which layer a test belongs in.
Frontend behaviorFormatting check, lint, and relevant tests following the frontend testing rules. Add type checking for type/interface changes, web build for routing/bundling/SSR changes, and desktop build for affected CSR integration.
Shared interfaces, dependencies, features, cross-component changesExpand checks to affected consumers and build/platform combinations; use the wider workspace suite when the impact crosses package boundaries.
SQLite migrationsMigration upgrade/integrity checks; for table rebuilds use the conditional procedure in CONTRIBUTING.md.
Release preparationVersion/lockfile consistency, release-note provenance and locale parity, links, and docs build as described in the release skill.

Write a test only when a realistic bug would make it fail. Tests that restate literals, defaults, constructors or derives, exercise std/third-party behavior, or repeat another test at a different layer add maintenance without catching bugs. Prefer deterministic tests without real network calls unless testing an integration explicitly. Put unit tests beside the module and integration tests under the crate's tests/. Use Tokio's test harness for async tests; bound waits that could otherwise hang. Nextest does not run doctests, so run Cargo doctests when documentation examples or the APIs they exercise change. Before opening a PR that adds or substantially edits tests, audit the test diff with the test review skill (preferring a fresh read-only subagent) and drop low-signal cases.

After relevant checks pass, repeat or broaden them only for new changes, failures, or unresolved risks. If a tool or platform is unavailable, complete independent work and applicable alternative checks, then report the exact unverified portion and its impact. Do not describe blocked validation as passed or a release as ready when required evidence is missing. CI remains the integration gate; see its workflow for the full matrix.

Rust engineering conventions

  • Use rustfmt defaults and idiomatic names. Group explicit imports as std, external crates, then crate/super.
  • Prefer extending an existing module unless the change introduces a separate logical component. Use src/foo.rs / src/foo/; do not introduce mod.rs files.
  • Comments explain the current behavior and its rationale: invariants, caller contracts, ordering constraints, and non-obvious reasons. Avoid restating code, narrating a chat/PR history, or past-facing wording such as "preserve the existing behavior" or how the code differs from an earlier or unshipped revision; state the actual backwards-compatibility constraint instead. A comment must make sense to someone reading only the final file. A relevant upstream issue may support a workaround, but explain the constraint locally so the comment stands on its own.
  • Do not leak our conversation, prompt, or iteration history into code comments, pull request descriptions, or other maintainer-facing prose. Write for readers who have not seen the conversation.
  • Collapse nested if statements with let chains when equivalent and clearer, following Clippy. Keep stylistic cleanup within the task's changed area.
  • Prefer explicit types over string-based APIs; validate strings at boundaries. Prefer Arc<T> for shared ownership and release locks before .await where possible; never hold a synchronous mutex guard across an await.
  • Do not introduce unwrap() / expect() in production paths. Propagate errors with context and use targeted thiserror variants before flattening errors to strings. anyhow::Result<()> is acceptable at binary entrypoints.
  • Do not silently discard an unhandled Result. Use ? for propagation or an explicit recovery path with appropriate logging/metrics. let _ = call()?; propagates errors and discards the success value; use call()?; when no binding is needed. Propagation alone does not require a duplicate log.
  • Backend errors use the error type of the crate that raises them, which wraps lower crates' errors instead of copying their variants (see the backend rules); path-related IO should use that type's io_path(op, path, source). Library errors belong to the library's own error type.
  • Use structured tracing fields. Add #[instrument] where context is useful, with skip(...) for secrets or unsuitable fields. Log-and-continue only when proceeding is safe; redact tokens, cookies, stream keys, and private data.
  • Preserve runtime and architecture boundaries: backend orchestration in rust-srec/src/main.rs, services in rust-srec/src/services/, Tokio tasks, and the existing allocator setup. Avoid blocking async handlers and unnecessary allocations in hot paths; prefer borrowing or Bytes for byte-oriented data.

Completion, commits, and cleanup

A task is complete when the requested scope is implemented, necessary related docs/generated outputs are updated, relevant validation is accounted for, and the final diff has been reviewed. Report what changed, the checks and their results, and any remaining limitation. A review-only task ends with findings and recommendations, following any requested approval boundary.

Continue authorized work through implementation and validation. Existing user instructions or an agreed issue establish scope; do not reopen that decision for routine implementation choices. If essential information is missing, ask once with the concrete dependency and continue work that does not depend on the answer. Explain an actual blocker rather than stopping at a plan or treating optional checks as mandatory approval gates.

Commit, open a PR, push, or tag according to the task's existing authorization; a request for a PR includes the needed task branch, commit, and branch push. Release tags/publication follow the release skill's separate scope. Review the staged diff and include only the task's files/hunks. Commits and PR bodies carry no AI-tool attribution (no Co-Authored-By trailer or "Generated with" footer). An unrequested commit or a completely clean worktree is not a completion requirement.

User-visible changes get an entry in rust-srec/docs/{en,zh}/release-notes/unreleased.md, in both languages:

  • Write for someone who runs the app, not someone who reads the source: lead with what users will see differently and any action they need to take. Keep entries concise and scannable; no type, field, file or trait names, no implementation reasoning, and no engineering or UI-layout jargon (keyframe, container, scheduler, Web Worker, structured lists, 全宽卡片, 引用详情).
  • Use exact UI labels from rust-srec/frontend/src/locales/{en,zh-CN}/messages.po and format settings, buttons, tabs and notification events in bold consistently. In zh, address the user as 你 (never 您), write idiomatic Chinese rather than literal translations, use 会话 and 标签页, and put spaces around inline **粗体** next to Chinese characters. In en, use British spelling, avoid contractions, and start fixes directly with Fixed ... / Prevented .... For full guidelines, examples, and release-time audits, see release-notes style.
  • A fix for a regression whose cause is in no release (git tag --contains <sha> is empty) gets no entry, because users never saw the bug. Say so in the PR body.
  • Link to the docs site at https://docs.srec.rs/ (e.g. /en/release-notes/vX.Y.Z) and keep en and zh aligned bullet-for-bullet.

Remove only clearly disposable temporary artifacts created by this task. Preserve pre-existing changes, untracked work, local data, and useful caches. Avoid repository-wide formatting, unrelated fixes, destructive cleanup, or deleting files merely to make git status clean.

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.