Agent-Guidance-Python
AGENTS.md2 starsChanged 4 months agoMITView on GitHub
agent-guidance-mcp saves tokens through 4 automatic mechanisms: Config (already set globally): AGENT_GUIDANCE_FILTER_LEVEL=aggressive, doc/skill caps reduced to 2K/3K — aggressive filtering by default. How to maximize savings: - Always use agent-guidance-mcp_task_pipeline → agent-guidance-mcp_project_context/agent-guidance-mcp_guidance instead of raw tools (Rule 3). - Call agent-guidance-mcp_token_stats at end of each phase to verify compression ratio. - If token usage is still high, set AGENT_GUIDANCE_TOKEN_OPT=0 to disable (not recommended). Tool naming note: Some MCP hosts prefix tool names with agent-guidance-mcp_ (e.g. agent-guidance-mcp_task_pipeline), while others expose bare…
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 repository169 other files it gives its agents.
- agent-guidanceSkill
- accessibilitySkill
- adaptive-languageSkill
- agent-sortSkill
- agent-workflow-opsSkill
- android-clean-architectureSkill
- api-designSkill
- architecture-decision-recordsSkill
- automation-audit-opsSkill
- backend-patternsSkill
- blender-motion-state-inspectionSkill
- blueprintSkill
- browser-qaSkill
- bun-runtimeSkill
- canary-watchSkill
- carrier-relationship-managementSkill
- ci-cd-and-automationSkill
- cisco-ios-patternsSkill
- claude-devfleetSkill
- codebase-onboardingSkill
- codehealth-mcpSkill
- code-review-and-qualitySkill
- code-simplificationSkill
- codex-vscodeSkill
- coding-standardsSkill
- compose-multiplatform-patternsSkill
- configure-eccSkill
- connections-optimizerSkill
- context-budgetSkill
- continuous-learning-v2Skill
- cost-aware-llm-pipelineSkill
- cost-trackingSkill
- councilSkill
- cpp-coding-standardsSkill
- cpp-testingSkill
- customer-billing-opsSkill
- customs-trade-complianceSkill
- database-migrationsSkill
- data-scraper-agentSkill
- debugging-and-error-recoverySkill
- deep-researchSkill
- deployment-patternsSkill
- deprecation-and-migrationSkill
- design-systemSkill
- django-celerySkill
- django-patternsSkill
- django-securitySkill
- django-tddSkill
- django-verificationSkill
- dmux-workflowsSkill
- docker-patternsSkill
- documentation-lookupSkill
- doubt-driven-developmentSkill
- e2e-testingSkill
- energy-procurementSkill
- error-handlingSkill
- eval-harnessSkill
- fastapi-patternsSkill
- finance-billing-opsSkill
- foundation-models-on-deviceSkill
- The first 60 shown.
The file
We split this AGENTS.md into the rules it gives an agent
11 rules. About 0 are common, 2 are distinctive, and 9 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.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Always use agent-guidance-mcp_task_pipeline → agent-guidance-mcp_project_context/agent-guidance-mcp_guidance instead of raw tools (Rule 3).
- Very specific: line 16
Call agent-guidance-mcp_token_stats at end of each phase to verify compression ratio.
- Very specific: line 17
If token usage is still high, set AGENT_GUIDANCE_TOKEN_OPT=0 to disable (not recommended).
- Very specific: line 56
Ask the user for approval in Ask/Revise stage.
- Very specific: line 60
If errors/regressions arise, transition to Fix and then re-test.
- Very specific: line 63
If unresolved after 3 attempts, you must STOP editing code, revert stage to Ask/Revise, and ask user for guidance.
- Very specific: line 67
Context First: Call agent-guidance-mcp_task_pipeline or agent-guidance-mcp_project_context BEFORE any file read or code change.
- Very specific: line 68
Standards Check: Use agent-guidance-mcp_guidance(operation="search") BEFORE implementing or answering any prompt.
- Distinctive: line 69
Token Budget: Prefer MCP tools over raw file reads — built-in limits prevent context blowout.
- Distinctive: line 70
No Direct FS: Never manually read/search files when MCP tools do it with optimization.
- Very specific: line 71
Ground & Plan: Verify files/functions/symbols via search BEFORE proposing changes.
≈ “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.
Files
AGENTS.md
Token Saving — Built-in Optimization
agent-guidance-mcp saves tokens through 4 automatic mechanisms:
- Bounded reads —
agent-guidance-mcp_project_context(operation="read")caps at 300 lines;searchcaps snippets at 300 chars andlimitat 20 results. Replaces expensive raw file reads. - Content compression — Language-aware comment/whitespace removal, dedup, badge-stripping. Applies to every read/search response automatically.
- Per-type token budgets — Source files 3K, docs 2K, skills 3K, task_pipeline 12K tokens max per call.
- Tracking & reporting — Every optimized call records original vs. optimized tokens to SQLite. View with
agent-guidance-mcp_token_stats(session) oragent-guidance-mcp_usage_report(scope="all")(lifetime).
Config (already set globally): AGENT_GUIDANCE_FILTER_LEVEL=aggressive, doc/skill caps reduced to 2K/3K — aggressive filtering by default.
How to maximize savings:
- Always use
agent-guidance-mcp_task_pipeline→agent-guidance-mcp_project_context/agent-guidance-mcp_guidanceinstead of raw tools (Rule 3). - Call
agent-guidance-mcp_token_statsat end of each phase to verify compression ratio. - If token usage is still high, set
AGENT_GUIDANCE_TOKEN_OPT=0to disable (not recommended).
Tool naming note: Some MCP hosts prefix tool names with agent-guidance-mcp_ (e.g. agent-guidance-mcp_task_pipeline), while others expose bare names (task_pipeline). The examples below use prefixed names. When calling, always use the exact tool name shown in your available-tools list — never add or drop a prefix.
CRITICAL — Tool Rules (READ FIRST)
For EVERY user interaction — planning, implementation, testing, debugging, reviewing, refactoring, or any other action:
<!-- agent-guidance:start -->Agent Guidance MCP — Tool Selection Priority
| You need to... | Use THIS tool first | Why |
| Start any task or phase | agent-guidance-mcp_task_pipeline(task="...") | Recommendations + tree + code search + UI in ONE call |
| Check coding standards / skills | agent-guidance-mcp_guidance(operation="search", query="...") | No other tool provides standards or skill lookup |
| Read a file | agent-guidance-mcp_project_context(operation="read", relative_path="...") | Token-capped at 300 lines — prevents context blowout |
| Search codebase text | agent-guidance-mcp_project_context(operation="search", query="...") | Ranked, bounded results. Fallback when codegraph unavailable |
| Understand code structure | agent-guidance-mcp_project_context(operation="structure", relative_path="...") | Hierarchical view of classes, methods, functions in a file |
| Extract symbols | agent-guidance-mcp_project_context(operation="symbols", relative_path="...") | Flat list of classes, functions, methods with signatures |
| Get structured workflow | agent-guidance-mcp_guidance(operation="workflow", identifier="plan") → "code" → "test" | Enriched dev workflow with auto-chaining |
| Pre-code checklist | agent-guidance-mcp_guidance(operation="precode", query="...") | Coding conventions, security, testing, arch, deploy rules |
| Post-code verification | agent-guidance-mcp_guidance(operation="verify", query="...") | Auto-detect test/review/security/audit/deploy; suggests next workflow |
| Skill feedback loop | agent-guidance-mcp_guidance(operation="feedback", identifier="...", rating=1-5, query="...") | Rate skills to boost future recommendations for similar tasks |
| Find symbol references | agent-guidance-mcp_project_context(operation="references", query="...") | Locate all usages of a symbol across the codebase |
| Get UI/design guidance | agent-guidance-mcp_ui_ux(operation="search", query="...") | Style, colors, typography, charts, slides |
| Check workflow stage | agent-guidance-mcp_workflow_gate(action="check"/"status"/"set_stage") | Verify plan approvals and progress lifecycle |
| Persist/recover session | agent-guidance-mcp_session_continuity(operation="save"/"load"/"clear") | State recovery / task checklist continuity |
| Browse project tree | agent-guidance-mcp_project_context(operation="tree") | Optimized directory tree view |
Standard Workflow Lifecycle & Feedback Loops
You must strictly follow this lifecycle for every feature or task:
[Context] -> [Plan] -> [Ask/Revise] -> [Build] -> [Test/Recheck] -> [Fix] -> [Document/Proposal]
MANDATORY workflow rule:
You BẮT BUỘC phải gọi workflow_gate(action="check", user_message="<tin nhắn cuối cùng của user>") ở đầu mỗi lượt phản hồi (turn) trước khi gọi bất kỳ tool nào khác. Nếu workflow_gate trả về plan_approved: false hoặc trả về lỗi WORKFLOW_STAGE_BLOCKED, bạn tuyệt đối không được viết code hay sửa file và phải quay lại xin chỉ thị.
- Planning Loop (Human <-> Agent):
- Propose a plan in
Planstage. - Ask the user for approval in
Ask/Revisestage. - Move to
BuildONLY after user has explicitly approved (ok, proceed, approved, start, đồng ý, làm đi...).
- Propose a plan in
- Execution & Quality Loop (Autonomous):
- Transition to
Test/Recheckafter writing code inBuild. - If errors/regressions arise, transition to
Fixand then re-test.
- Transition to
- Circuit Breaker Rule:
- Max 3 consecutive fix attempts for the same issue in the Execution Loop.
- If unresolved after 3 attempts, you must STOP editing code, revert stage to
Ask/Revise, and ask user for guidance.
Nine Mandatory Rules
- Context First: Call
agent-guidance-mcp_task_pipelineoragent-guidance-mcp_project_contextBEFORE any file read or code change. - Standards Check: Use
agent-guidance-mcp_guidance(operation="search")BEFORE implementing or answering any prompt. - Token Budget: Prefer MCP tools over raw file reads — built-in limits prevent context blowout.
- No Direct FS: Never manually read/search files when MCP tools do it with optimization.
- Ground & Plan: Verify files/functions/symbols via search BEFORE proposing changes. Never guess.
- 300 LOC Cap: Split files exceeding 300 lines of code. No monolithic files.
- Intent Gate: Classify request type (trivial/explicit/exploratory/open-ended/ambiguous) before acting. If ambiguous, clarify first.
- Delegation Before Action: Decompose multi-step tasks and delegate to specialized subagents. Never implement directly when delegation is possible.
- Per-Phase Reset: For EACH new work phase (plan → implement → test → debug → review → refactor), re-call
agent-guidance-mcp_task_pipelinewith that phase's goal. Do NOT carry old context across phases. A new phase is a new task.
CRITICAL: All 9 rules apply to EVERY action without exception — planning, implementation, testing, debugging, reviewing, refactoring, or any other work. There is no action type exempt from these rules.
<!-- agent-guidance:end -->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.

