agentleFS
wecode-aiwecode-ai/Wegent/AGENTS.md

Wegent

AGENTS.md867 starsChanged 3 months agoApache-2.0View on GitHub

Wegent is an AI-native operating system for defining, organizing, and running agent teams. Keep the system simpler after every change: reuse existing abstractions, remove obsolete paths, and fix the primary flow rather than hiding defects behind fallbacks. Use docs/en/ and docs/zh/ for detailed architecture and guides. Keep this file limited to durable contributor rules. New documentation needs frontmatter with sidebar_position; write Chinese first, then English. backend/ remains the default implementation for the public API while the Rust migration is in…

  • Commits and pushes
  • 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.

  • In this repository7 other files it gives its agents.

The file

Show its rules and text

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

19 rules. About 2 are common, 9 are distinctive, and 8 are very specific to this project.

  • ≈2

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Use docs/en/ and docs/zh/ for detailed architecture and guides.

    line 19
  2. Very specific:

    Before modifying wework/, read and follow wework/AGENTS.md.

    line 23
  3. Very specific:

    Before modifying frontend/, read and follow frontend/AGENTS.md.

    line 24
  4. Very specific:

    Before modifying backend-rs/, read and follow backend-rs/AGENTS.md.

    line 25
  5. Distinctive:

    Add module-specific instructions beside a module only when they cannot be expressed as a repository-wide rule.

    line 26
  6. Distinctive:

    Do not duplicate a behavior change in both implementations merely because the hybrid gateway has a Python fallback.

    line 60
  7. Distinctive:

    Before adding code, search for and reuse existing components, services, utilities, and patterns.

    line 85
  8. Distinctive:

    Delete dead code. Do not add compatibility shims or fallback paths without agreement.

    line 87
  9. Very specific:

    Use uv run for every Python command.

    line 92
  10. Distinctive:

    Follow PEP 8, Black (88 columns), isort, and type hints.

    line 93
  11. Very specific:

    Use strict TypeScript, function components, const, single quotes, and no semicolons.

    line 98
  12. Very specific:

    Check existing UI in src/components/ui/, src/components/common/, and feature components before creating new components.

    line 99
  13. Very specific:

    Run a package-owned binary through that package, for example pnpm --filter wework exec prettier.

    line 101
  14. Distinctive:

    Run focused tests before committing.

    line 107
  15. Distinctive:

    Treat intermittent test failures as defects: investigate and fix them immediately before proceeding.

    line 108
  16. Distinctive:

    Every E2E scenario must be invoked by GitHub CI.

    line 109
  17. Common:

    Never commit credentials or session files.

    line 136
  18. Distinctive:

    Only expose client-safe frontend settings through the appropriate public environment variable convention.

    line 137
  19. Common:

    Do not log tokens, API keys, or the contents of local authentication files.

    line 138

≈ “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

Wegent contributor guide

Wegent is an AI-native operating system for defining, organizing, and running agent teams. Keep the system simpler after every change: reuse existing abstractions, remove obsolete paths, and fix the primary flow rather than hiding defects behind fallbacks.

Repository map

<!-- prettier-ignore -->
AreaTechnologyResponsibility
backend/FastAPI, SQLAlchemy, MySQLREST API and business logic
backend-rs/Rust, Tokio, BreezeHybrid gateway and incrementally migrated API implementations
frontend/Next.js, React, TypeScriptMain web product
wework/Electron, Vite, React, TypeScriptDesktop workbench and local coding experience
executor/, executor_manager/Python, DockerAgent execution and orchestration
chat_shell/FastAPI, LangGraphLightweight chat runtime
knowledge_runtime/, knowledge_doc_converter/FastAPI, CeleryRAG and document conversion
shared/PythonShared utilities, models, cryptography and telemetry

Use docs/en/ and docs/zh/ for detailed architecture and guides. Keep this file limited to durable contributor rules. New documentation needs frontmatter with sidebar_position; write Chinese first, then English.

Scoped instructions

  • Before modifying wework/**, read and follow wework/AGENTS.md. It contains the desktop UI, local runtime, i18n, and Electron verification rules.
  • Before modifying frontend/**, read and follow frontend/AGENTS.md. It contains web-frontend state, responsive UI, and i18n rules.
  • Before modifying backend-rs/**, read and follow backend-rs/AGENTS.md. It defines API ownership during the Rust migration and Rust-specific verification.
  • Add module-specific instructions beside a module only when they cannot be expressed as a repository-wide rule.

Backend migration ownership

backend/ remains the default implementation for the public API while the Rust migration is in progress. Do not infer API ownership from a shared utility, a Rust foundation module, or the existence of a similarly named Python route. An API is migrated only when both of these are true:

  1. backend-rs registers a Rust handler for it.
  2. An active WEGENT_RS_ROUTES_FILE rule selects its method and path for Rust (the repository default is backend-rs/config/routes.toml).

The checked-in default route table activates only the APIs that have completed cutover; every other request is forwarded to Python. Use the following ownership rules for every API change:

ChangeWhere to implement it
New public APIbackend/ only; do not start a Rust migration as part of feature work.
Existing API not selected for Rustbackend/
Existing API already selected for and implemented by Rustbackend-rs/

Finding migrated APIs

backend-rs/config/routes.toml is the checked-in inventory of public APIs selected for Rust. Before changing an existing API, inspect each [[routes]] entry for the matching method and path, then confirm its Rust handler is registered by Application. If the task specifies WEGENT_RS_ROUTES_FILE, use that file instead. Do not maintain a separate hand-written API inventory: the route configuration must remain the single source of truth. A migration change must update the handler, its route entry, and focused compatibility tests together.

Do not duplicate a behavior change in both implementations merely because the hybrid gateway has a Python fallback. Changes to the route table, routing an endpoint to Rust, or adding/upgrading Rust dependencies are migration work and need explicit task scope. If the handler registration and route selection do not agree, stop and ask for direction rather than choosing an owner by guesswork.

Domain model

Ghost (prompt, MCP servers, skills)
  -> Bot (Ghost + Shell + optional Model)
  -> Team (Bots + collaboration mode)
  -> Task (Team + Workspace)

Code uses CRD terms. In Chinese UI, Team is “智能体” and Bot is “机器人”; English UI calls them Agent and Bot.

  • A Kind resource is identified by namespace, name, and user_id; always query all three.
  • Task and Workspace use TaskResource in tasks; other CRDs use Kind in kinds.
  • Shell types: Codex, ClaudeCode, Agno, Dify, and Chat.

Engineering rules

  • Diagnose problems from logs, actual code, and other concrete evidence first. When evidence is insufficient, add focused diagnostic logging before changing behavior; do not guess.
  • Comments are English. Use clear names, type hints for Python, and keep functions focused (prefer under 50 lines).
  • Before adding code, search for and reuse existing components, services, utilities, and patterns. Extract shared logic instead of duplicating it.
  • Favor cohesive modules, explicit interfaces, and standard practices. Split files over 1000 lines.
  • Delete dead code. Do not add compatibility shims or fallback paths without agreement; correct the primary path.
  • Fix defects discovered while working when they are in scope or block correctness.

Python

  • Use uv run for every Python command.
  • Follow PEP 8, Black (88 columns), isort, and type hints.
  • Mock external services in unit tests; use Arrange, Act, Assert.

TypeScript and React

  • Use strict TypeScript, function components, const, single quotes, and no semicolons.
  • Check existing UI in src/components/ui/, src/components/common/, and feature components before creating new components.
  • Preserve existing data-testid values; if one changes, update its E2E coverage in the same change. All new interactive elements need descriptive data-testid values.
  • Run a package-owned binary through that package, for example pnpm --filter wework exec prettier; do not use root-level pnpm exec for tools declared only in a workspace package.

Testing and verification

Prioritize fast, iterative development. Run E2E tests and ai:verify only when the user explicitly requests them. This execution policy overrides automatic E2E and real-Electron verification requirements in scoped guides; those guides still define how to verify when requested.

Run focused tests before committing; run broader tests when risk warrants it. E2E tests may mock only model services; every other component and integration must be real. They may not silently skip or fail gracefully, and failures must be fixed rather than skipped. Treat intermittent test failures as defects: investigate and fix them immediately before proceeding; never use reruns or retries to obtain a passing result or hide the underlying problem. Every E2E scenario must be invoked by GitHub CI. Focused local E2E commands may exist for debugging, but they must also be included by a CI-covered suite; do not add dead E2E coverage that CI never runs. Long desktop E2E flows must expose registered checkpoints through the shared runner. A checkpoint must establish its own minimal prerequisites so both one-checkpoint and from-checkpoint runs are valid; do not depend on state created only by an earlier skipped checkpoint.

cd backend && uv run pytest
cd executor && uv run pytest
pnpm --dir frontend test

Git workflow

  • Branches: <type>/<description> where type is feature, fix, refactor, docs, test, or chore.
  • Commits use Conventional Commits: <type>[scope]: <description>.
  • Respect Husky output; never use --no-verify.
  • Pull the latest main branch and resolve conflicts before opening a PR. Run git push in an isolated background process because pre-push checks are expensive.

Module quick reference

  • Backend endpoints: API route in app/api/, schemas in app/schemas/, logic in app/services/. Persistent model changes require an Alembic migration; verify upgrade head and the rollback before handing off.
  • Rust Backend: read backend-rs/AGENTS.md before changing it. Its public listener handles only explicitly selected migrated routes; all other traffic proxies to backend/.
  • Executor types live in executors/; scheduler/orchestration lives in executor_manager/.
  • Knowledge Runtime serves internal RAG APIs on port 8200. The converter uses the knowledge_conversion Celery queue.
  • Chat Shell supports http, package, and cli modes.
  • For changed Backend or Executor critical paths, use the tracing helpers in shared/telemetry/decorators.py instead of creating uninstrumented asynchronous main flows.

Security

  • Never commit credentials or session files. Use environment configuration for secrets.
  • Only expose client-safe frontend settings through the appropriate public environment variable convention.
  • Do not log tokens, API keys, or the contents of local authentication files.

Common ports

frontend 3000, backend 8000, chat_shell 8001, knowledge_runtime 8200, MySQL 3306, Redis 6379.

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.