agentleFS
lza6lza6/claw-code-tingfeng/AGENTS.md

claw-code-tingfeng

AGENTS.md4 starsChanged 7 months agoMITView on GitHub

Clawd Code is an AI-powered coding agent framework (Python 3.10+) featuring multi-agent swarm intelligence, self-healing, codebase awareness, enterprise-grade RAG, and a full workflow engine. The swarm system in src/agent/swarm/ orchestrates specialized agents: src/agent/swarm/self_fission/ automatically splits complex tasks into sub-tasks: Located in agents/, these are prompt-based personas that can be used to configure agent behavior: src/brain/world_model.py — The system's "consciousness layer": - Maintains a live dependency graph of the codebase (AST-based) - Trigram-based semantic index for code search - Pattern detection…

The file

Show its rules and text

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

13 rules. About 1 is common, 5 are distinctive, and 7 are very specific to this project.

  • ≈1

    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
  1. Distinctive:

    Use pytest with descriptive test names

    line 77
  2. Very specific:

    Use structured error codes from src/core/exceptions.py:

    line 85
  3. Common:

    No secrets or API keys in code

    line 110
  4. Very specific:

    SKILL.md: Always uppercase, always this exact filename

    line 129
  5. Very specific:

    Use set -e for fail-fast behavior

    line 160
  6. Very specific:

    Write status messages to stderr: echo "Message" >&2

    line 161
  7. Distinctive:

    Write machine-readable output (JSON) to stdout

    line 162
  8. Distinctive:

    Don't duplicate content between skills — reference other skills instead

    line 167
  9. Distinctive:

    Don't add skills that are vague advice instead of actionable processes

    line 168
  10. Distinctive:

    Don't create supporting files unless content exceeds 100 lines

    line 169
  11. Very specific:

    Don't put reference material inside skill directories — use references/ instead

    line 170
  12. Very specific:

    claude.ai: Add the skill to project knowledge or paste SKILL.md contents into the conversation

    line 184
  13. Very specific:

    If a skill requires network access, instruct users to add required domains at claude.ai/settings/capabilities.

    line 186

≈ “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 guidance to AI coding agents when working with code in this repository.

Repository Overview

Clawd Code is an AI-powered coding agent framework (Python 3.10+) featuring multi-agent swarm intelligence, self-healing, codebase awareness, enterprise-grade RAG, and a full workflow engine.

Architecture

Multi-Agent Swarm System

The swarm system in src/agent/swarm/ orchestrates specialized agents:

RoleFileResponsibility
Orchestratororchestrator.pyTask decomposition and dispatch
Coder/Workercoder_agent.pyCode implementation
Architectarchitect_agent.pyArchitecture design and review
Auditorauditor.pyCode audit and quality checks
Integratorintegrator.pyResult integration

Self-Fission System

src/agent/swarm/self_fission/ automatically splits complex tasks into sub-tasks:

DetectorFileTriggers On
Securitydetectors/security.pySecurity-sensitive code patterns
Performancedetectors/performance.pyPerformance-critical operations
SQLdetectors/sql_usage.pyDatabase query patterns
CSS/TUIdetectors/css_tui.pyStyling and terminal UI
Cryptodetectors/crypto.pyCryptographic operations
Documentationdetectors/doc_needs.pyDocumentation gaps

Agent Personas (Prompt Templates)

Located in agents/, these are prompt-based personas that can be used to configure agent behavior:

  • code-reviewer.md — For code review tasks (five-axis evaluation)
  • security-auditor.md — For security-focused reviews
  • test-engineer.md — For test strategy and quality assurance

World Model (Brain)

src/brain/world_model.py — The system's "consciousness layer":

  • Maintains a live dependency graph of the codebase (AST-based)
  • Trigram-based semantic index for code search
  • Pattern detection (Factory, Strategy, Observer, Singleton, etc.)
  • Intent caching for efficient repeated queries

Self-Healing Engine

src/self_healing/engine.py — Autonomous error recovery:

  1. Error classification (classifier.py)
  2. AI-driven diagnosis (diagnoser.py)
  3. Fix generation and application
  4. Verification (verifier.py)
  5. Experience storage for future reference

Creating New Code

File Structure

src/
  <module>/
    __init__.py          # Public API exports
    <feature>.py         # Implementation
tests/
  <module>/
    test_<feature>.py    # Mirror source structure

Testing Standards

  • Use pytest with descriptive test names
  • Follow Arrange-Act-Assert pattern
  • Mock at system boundaries (LLM calls, file I/O, network)
  • Each test should verify one concept
  • Tests must be independent (no shared mutable state)

Error Handling

Use structured error codes from src/core/exceptions.py:

from src.core.exceptions import ClawdError, ErrorCode

raise ClawdError(ErrorCode.CONFIG_MISSING, "API key not configured")

Settings

Access settings via the 6-layer config system:

from src.core.settings import AgentSettings

settings = AgentSettings()
model = settings.llm_model

Code Quality Gates

Before submitting changes:

  1. python -m pytest tests/ -v --tb=short — All tests pass
  2. ruff check src/ — No lint errors
  3. No secrets or API keys in code
  4. Error handling uses structured error codes
  5. New dependencies added to both requirements.txt and pyproject.toml

Creating New Skills

Directory Structure

skills/
  {skill-name}/           # kebab-case directory name
    SKILL.md              # Required: skill definition
    scripts/              # Optional: executable scripts
      {script-name}.sh    # Bash scripts (preferred)

Naming Conventions

  • Skill directory: kebab-case (e.g. web-quality)
  • SKILL.md: Always uppercase, always this exact filename
  • Scripts: kebab-case.sh (e.g., deploy.sh, fetch-logs.sh)

SKILL.md Format

---
name: {skill-name}
description: Brief statement of what the skill does. Use when [specific trigger conditions].
---

# {Skill Title}

{Brief description of what the skill does.}

See docs/skill-anatomy.md for the full specification.

Best Practices for Context Efficiency

Skills are loaded on-demand — only the skill name and description are loaded at startup. The full SKILL.md loads into context only when the agent decides the skill is relevant. To minimize context usage:

  • Keep SKILL.md under 500 lines — put detailed reference material in separate files
  • Write specific descriptions — helps the agent know exactly when to activate the skill
  • Use progressive disclosure — reference supporting files that get read only when needed
  • Prefer scripts over inline code — script execution doesn't consume context (only output does)
  • File references work one level deep — link directly from SKILL.md to supporting files

Script Requirements

  • Use #!/bin/bash shebang
  • Use set -e for fail-fast behavior
  • Write status messages to stderr: echo "Message" >&2
  • Write machine-readable output (JSON) to stdout
  • Include a cleanup trap for temp files

What Not to Do

  • Don't duplicate content between skills — reference other skills instead
  • Don't add skills that are vague advice instead of actionable processes
  • Don't create supporting files unless content exceeds 100 lines
  • Don't put reference material inside skill directories — use references/ instead

Packaging and Distribution

Skills can be packaged for distribution:

cd skills
zip -r {skill-name}.zip {skill-name}/

Installation methods:

  • Claude Code: cp -r skills/{skill-name} ~/.claude/skills/
  • claude.ai: Add the skill to project knowledge or paste SKILL.md contents into the conversation

If a skill requires network access, instruct users to add required domains at claude.ai/settings/capabilities.

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.