mcp tuning

This commit is contained in:
2026-04-01 13:29:41 +03:00
parent 586229a974
commit 1e46073dd6
19 changed files with 1324 additions and 28593 deletions

View File

@@ -12,7 +12,7 @@ You **MUST** consider the user input before proceeding (if not empty).
## Goal
Ensure the codebase adheres to the semantic standards defined in `.ai/standards/semantics.md` by using the AXIOM MCP semantic graph as the primary execution engine. This involves reindexing the workspace, measuring semantic health, auditing contract compliance, and optionally delegating contract-safe fixes through MCP-aware agents.
Ensure the codebase adheres to the semantic standards defined in `.ai/standards/semantics.md` by using the AXIOM MCP semantic graph as the primary execution engine. This involves reindexing the workspace, measuring semantic health, auditing contract compliance, auditing decision-memory continuity, and optionally delegating contract-safe fixes through MCP-aware agents.
## Operating Constraints
@@ -25,6 +25,7 @@ Ensure the codebase adheres to the semantic standards defined in `.ai/standards/
7. **ID NAMING (CRITICAL)**: NEVER use fully-qualified Python import paths in `[DEF:id:Type]`. Use short, domain-driven semantic IDs (e.g., `[DEF:AuthService:Class]`). Follow the exact style shown in `.ai/standards/semantics.md`.
8. **ORPHAN PREVENTION**: To reduce the orphan count, you MUST physically wrap actual class and function definitions with `[DEF:id:Type] ... [/DEF]` blocks in the code. Modifying `@RELATION` tags does NOT fix orphans. The AST parser flags any unwrapped function as an orphan.
- **Exception for Tests**: In test modules, use `BINDS_TO` to link major helpers to the module root. Small helpers remain C1 and don't need relations.
9. **DECISION-MEMORY CONTINUITY**: Audit ADR nodes, preventive task guardrails, and reactive Micro-ADR tags as one anti-regression chain. Missing or contradictory `@RATIONALE` / `@REJECTED` is a first-class semantic defect.
## Execution Steps
@@ -48,8 +49,13 @@ Treat high orphan counts and unresolved relations as first-class health indicato
Use [`audit_contracts_tool`](.kilo/mcp.json) and classify findings into:
- **Critical Parsing/Structure Errors**: malformed or incoherent semantic contract regions
- **Critical Contract Gaps**: missing [`@DATA_CONTRACT`](.ai/standards/semantics.md), [`@PRE`](.ai/standards/semantics.md), [`@POST`](.ai/standards/semantics.md), [`@SIDE_EFFECT`](.ai/standards/semantics.md) on CRITICAL contracts
- **Decision-Memory Gaps**:
- missing standalone `[DEF:id:ADR]` for repo-shaping decisions
- missing `@RATIONALE` / `@REJECTED` where task or implementation context clearly requires guardrails
- retained workaround code without local reactive Micro-ADR tags
- implementation that silently re-enables a path declared in upstream `@REJECTED`
- **Coverage Gaps**: missing [`@TIER`](.ai/standards/semantics.md), missing [`@PURPOSE`](.ai/standards/semantics.md)
- **Graph Breakages**: unresolved relations, broken references, isolated critical contracts
- **Graph Breakages**: unresolved relations, broken references, isolated critical contracts, ADR nodes without downstream guarded contracts
### 4. Build Remediation Context
@@ -58,12 +64,14 @@ For the top failing contracts, use MCP semantic context tools such as [`get_sema
2. Upstream/downstream semantic impact
3. Related tests and fixtures
4. Whether relation recovery is needed
5. Whether decision-memory continuity is broken between ADR, task contract, and implementation
### 5. Execute Fixes (Optional/Handoff)
If $ARGUMENTS contains `fix` or `apply`:
- Handoff to the [`semantic`](.kilocodemodes) mode or a dedicated implementation agent instead of applying naive textual edits in orchestration.
- Require the fixing agent to prefer MCP contract mutation tools such as [`simulate_patch_tool`](.kilo/mcp.json), [`guarded_patch_contract_tool`](.kilo/mcp.json), [`patch_contract_tool`](.kilo/mcp.json), and [`infer_missing_relations_tool`](.kilo/mcp.json).
- Require the fixing agent to preserve or restore `@RATIONALE` / `@REJECTED` continuity whenever blocked-path knowledge exists.
- After changes, re-run reindex, health, and audit MCP steps to verify the delta.
### 6. Review Gate
@@ -74,8 +82,9 @@ Before completion, request or perform an MCP-based review path aligned with the
Provide a summary of the semantic state:
- **Health Metrics**: contracts / relations / orphans / unresolved_relations / files
- **Status**: [PASS/FAIL] (FAIL if CRITICAL gaps or semantically significant unresolved relations exist)
- **Status**: [PASS/FAIL] (FAIL if CRITICAL gaps, rejected-path regressions, or semantically significant unresolved relations exist)
- **Top Issues**: List top 3-5 contracts or files needing attention.
- **Decision Memory**: summarize missing ADRs, missing guardrails, and rejected-path regression risks.
- **Action Taken**: Summary of MCP analysis performed, context gathered, and fixes or handoffs initiated.
## Context