synapse-agent
AGENTS.md7 starsChanged 49 days agoApache-2.0View on GitHub
- Reads credentials
- Commits and pushes
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 31,774 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 repository7 other files it gives its agents.
- web/AGENTS.mdAGENTS.md
- cua-driverSkill
- file-cleanupSkill
- game-controlSkill
- project-session-readerSkill
- session-cache-analysisSkill
- session-crash-repairSkill
The file
We split this AGENTS.md into the rules it gives an agent
12 rules. About 0 are common, 5 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
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
- Distinctive: line 22
Avoid unbounded reads, searches, and terminal output.
- Very specific: line 23
Never leak API keys, tokens, .env contents, or private user config in code, tests, docs, or output.
- Distinctive: line 24
Update README/docs when user-visible behavior changes.
- Very specific: line 28
Run uv sync after the first install or dependency changes.
- Distinctive: line 74
When changing either crate, at least run:
- Very specific: line 81
If Python bindings/APIs change, rebuild via uv sync --reinstall-package <crate> and run the related Python tests.
- Very specific: line 83
Keep the Apache-2.0 SPDX headers in rust/synapse-tool-compress-core/src/headroom_port/*.rs, the crate's LICENSE and NOTICE at …
- Distinctive: line 87
Before any git push, ask the user: "Do we need to tag a release this time?"
- Very specific: line 91
Read the current version from pyproject.toml and let the user confirm or override it.
- Very specific: line 93
Add a ## v{version} section at the top of CHANGELOG.md.
- Very specific: line 94
Update pyproject.toml if the version changed.
- Distinctive: line 95
Don't run any test
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 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.
Files
Synapse Collaboration Guide
Architecture
- Domain packages live under
src/synapse/(eachsynapse.<package>); their tests are flat files named after the domain undertests/(tests/test_<area>*.py, plustests/fixtures/) — do not add per-package subdirectories there. Rust/PyO3 crates live underrust/; the MkDocs site lives underdocs/+mkdocs.yml. - Repository Agent Skills live in
skills/<name>/SKILL.md(YAML front matter:name,description,license,compatibility,allowed_tools). The defaultskills_pathsis["skills"]relative to the project root (src/synapse/settings/schema.py);src/synapse/content/skills_catalog.pydiscovers them and feeds/skills, anddocs/skills.mddocuments the feature.skills/is excluded from the sdist ([tool.hatch.build.targets.sdist]), so the skills travel with the checkout, not with the wheel. Keep the front matter accurate — it is what the catalog surfaces. src/synapse/app/agent.pyis the assembly composition root; the reusable assembly contracts (middleware build, typed resource wiring) live insrc/synapse/app/agent_assembly.py. Keep domain algorithms in their own packages.- New features belong in the matching domain package; cross-domain wiring goes in
app/or an explicit runtime middleware. - Console-script entry points live in
src/synapse/entry.py(synapse),src/synapse/web.py(synapse-web, textual-serve TUI in the browser),src/synapse/acp/server.py(synapse-acp), andsrc/synapse/runtime/daemon/entry.py(synapse-runtime). The loopback React console host lives insrc/synapse/web_console/entry.pyand is reached through thesynapse web-consolesubcommand (src/synapse/cli.py) orpython -m synapse.web_console.entry, not a standalone console script. Keep entry modules thin; delegate to a domain package. These scripts only exist after an install/sync step (uv sync); in a stale source checkout run the module form (python -m synapse.web_console.entry) instead, and start the console host/daemon detached with redirected stdout/stderr — seeREADME.mdsection "Web 控制台". config.py,models_registry.py, andsubagents.pyare compatibility re-export layers. Import fromsynapse.settings,synapse.models.registry, orsynapse.runtime.subagent_specs/synapse.runtime.subagentsin new code; keep legacy import paths working.__init__.pyexports are public API. Keep necessary re-exports when moving implementations.- Config merges user and project layers. When changing Settings, update
src/synapse/settings/schema.py,src/synapse/settings/config_paths.py,tests/test_config.py,tests/test_layered_config.py, and the user docs (README.md,docs/config.md). AGENTS.mdis statically injected by the agent-md middleware (src/synapse/app/agent_md.py), independent of writable memory; never route it back into memory writes.- The browser console frontend lives in
web/(React 19 + TypeScript + Vite, built toweb/dist/); its conventions are inweb/AGENTS.md. Read that file before changing anything underweb/— this root file is the only one the agent-md middleware injects, soweb/AGENTS.mdis not loaded automatically. - The desktop shell (
rust/synapse-gui/, Tauri 2) loads the loopback console URL and owns the one thing a browser page cannot do: it opens the hosted speech engine's WebSocket itself (rust/synapse-gui/src/stt/), because that vendor authenticates the handshake with headers a browserWebSocketcannot set. The API key stays inside the shell process — read from~/.synapse/stt.json(which the daemon writes) and never crossing the IPC boundary, an event, or a command result.SttServicedeliberately refuses to relay a cloud dictation (src/synapse/runtime/service/stt.py): the daemon'sruntime.stt.*surface serves the local ONNX engine only, andsrc/synapse/stt/doubao.pyis now the reference implementation the Rust twin is ported from rather than the console's path. The composer picks its route inweb/src/components/composer/sttEngine.ts(speechRoute) and reaches both ends throughsttTransport.ts.
Coding standards
- Ruff is the only automated Python baseline: line length 100, target Python 3.12, rules
E/F/I/B/UPwithB008ignored (see[tool.ruff]inpyproject.toml). - Annotate new or modified public functions, complex state transitions, and compatibility branches.
- Catch broad exceptions only at explicit degradation boundaries, and explain the fallback; never swallow core business errors silently.
- Avoid unbounded reads, searches, and terminal output; cap logs, tool results, and external data.
- Never leak API keys, tokens,
.envcontents, or private user config in code, tests, docs, or output. - Update README/docs when user-visible behavior changes; skip doc churn for internal-only changes.
Development & testing
Run uv sync after the first install or dependency changes.
Verification order: narrowest test → domain tests
uv run --no-sync pytest tests/test_x.py -q
uv run --no-sync pytest tests/test_x.py::test_case_name -q| Change area | Preferred tests |
| settings/models | tests/test_config.py, tests/test_layered_config.py, model tests |
| backend/safety/runtime | tests/test_backends.py, tests/test_safety.py, middleware tests |
| tool output/compression | tests/test_tool_output.py, tests/test_tool_output_*, request compression tests |
| sessions/Codex import | tests/test_session_*, tests/test_transcript.py, tests/test_codex_* |
| CLI/slash commands | tests/test_cli.py, tests/test_slash_* |
| TUI/widgets/dialogs | tests/test_tui_*, tests/test_stream_*, tests/test_dialogs.py, component tests |
CI runs lint on ubuntu-latest and tests on Windows/Linux with Python 3.12/3.13. Platform-specific changes must at least pass on the current machine and be reviewed for the other platform.
A separate ubuntu contract job is the only gate on the generated contract: it runs uv run --no-sync python scripts/export_contract_manifest.py --check, the targeted tests/test_runtime_contract_manifest.py, tests/test_runtime_architecture_boundaries.py, tests/test_runtime_service_import_purity.py, tests/test_runtime_transport_client_compatibility.py subset, and then npx tsc -b plus the web console's runtimeContractFixture / runtimeClientBoundary / sourceGuard tests. A wire-contract change has to keep all of those green.
Docs and packaging:
uv run --no-sync mkdocs build # after touching docs/, README.md, or mkdocs.yml
uv build # after packaging/entry-point changesRust/PyO3 native crates
The Python app must work without the optional wheels and must keep ImportError/OSError fallbacks.
rust/synapse-core-tool(synapse-core-toolon PyPI): native filesystem tools (read/edit/patch/search), math rendering, and the native OpenAI-compatible chat client (RustOpenAIClient, backed byasync-openaibyot). Release with tagsynapse-core-tool-v*;native-core-tool-wheels.ymlbuilds wheels and publishes to GitHub Release + PyPI. Keep thepyproject.tomlversion in sync withCargo.toml— maturin names wheels frompyproject.toml.rust/synapse-tool-compress-core(synapse-tool-compress-coreon PyPI): native tool-output compression core. Required dependency ofsynapse-cli-agent. Release with tagsynapse-tool-compress-core-v*;native-compression-wheels.ymlbuilds wheels and publishes to GitHub Release + PyPI. Keep thepyproject.tomlversion in sync withCargo.toml. Because the main package hard-depends on it, publish the compress-core wheels to PyPI before tagging the mainv*release.
Building and installing a native crate locally
uv builds the path dependencies declared in [tool.uv.sources] (rust/synapse-core-tool and rust/synapse-tool-compress-core). After changing Rust code, rebuild + reinstall the affected crate with:
uv sync --reinstall-package synapse-core-toolThis runs maturin under the hood and installs the freshly built wheel into the venv. Do not rely on maturin develop — a plain uv sync afterwards re-copies the cached (stale) wheel over the develop install. To avoid that surprise, either always rebuild via uv sync --reinstall-package ..., or run every command with uv run --no-sync after a manual maturin develop.
When changing either crate, at least run:
cargo test --manifest-path rust/<crate>/Cargo.toml
cargo fmt --manifest-path rust/<crate>/Cargo.toml --checkIf Python bindings/APIs change, rebuild via uv sync --reinstall-package <crate> and run the related Python tests.
Keep the Apache-2.0 SPDX headers in rust/synapse-tool-compress-core/src/headroom_port/*.rs, the crate's LICENSE and NOTICE at rust/synapse-tool-compress-core/, and the upstream attribution intact; do not introduce excluded network calls or model downloads.
Release process
Before any git push, ask the user: "Do we need to tag a release this time?"
If releasing:
- Read the current version from
pyproject.tomland let the user confirm or override it. - Review changes since the last
v*tag withgit log. - Add a
## v{version}section at the top ofCHANGELOG.md; the heading must match the tag exactly, group entries by New Features / Bug Fixes / Engineering, and write entries in English (the section becomes the GitHub Release notes). - Update
pyproject.tomlif the version changed; syncuv.lockwhen needed. - Don't run any test
- Commit with
release: bump to v{version}. - Run:
powershell -ExecutionPolicy Bypass -File scripts/release.ps1- The script creates and pushes the
v{version}tag;release.ymlextracts the matching CHANGELOG section, runsuv build, and creates the GitHub Release.
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
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.

