trw-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| TRW_LOG_LEVEL | No | Log level for debug logging (e.g., DEBUG) | INFO |
| TRW_CEREMONY_MODE | No | Ceremony mode: 'full', 'light', or 'off' | full |
| TRW_EMBEDDINGS_ENABLED | No | Enable vector search (requires [vectors] extra) | false |
| TRW_BUILD_CHECK_ENABLED | No | Run pytest+mypy on trw_build_check | true |
| TRW_OBSERVATION_MASKING | No | Reduce verbosity in long sessions | true |
| TRW_LEARNING_MAX_ENTRIES | No | Max learnings before auto-pruning | 5000 |
| TRW_PROGRESSIVE_DISCLOSURE | No | Show tools progressively | false |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| logging | {} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| extensions | {
"io.modelcontextprotocol/ui": {}
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| trw_build_checkA | Record build/test results for ceremony tracking and delivery gates. Use when:
This tool does NOT execute subprocesses — run validation commands first, then call this with the results. Input:
Output: dict with fields {status, run_id?, outcome, tests_passed, coverage_pct, static_checks_clean, mypy_clean, coverage_threshold_failed?, gate_effects: list[str]}. |
| trw_session_startA | Load prior learnings + any active run so you start with full context. Use when:
Recalls high-impact learnings (patterns, gotchas, architecture decisions) and checks for an active run (phase, progress, last checkpoint). Partial-failure resilient: a failure in one sub-step does not block the others. Input:
Output: SessionStartResultDict with fields {learnings: list, learnings_count: int, learnings_omitted?: int, run: RunStatusDict, auto_recalled?: list, health_summary?: str (compact), embed_health?: dict (verbose), assertion_health?: dict (verbose), framework_reminder: str, errors: list, success: bool, compact: bool, payload_token_estimate: int}. Example: trw_session_start(query="sqlite extension macos") → {"learnings": [...], "learnings_count": 8, "compact": true, "health_summary": "embed=ok; start=42ms (verbose=True for ...)", "run": {"active_run": "/path/...", "phase": "IMPLEMENT"}, ...} See Also: trw_init, trw_recall |
| trw_deliverA | Persist learnings and progress so future sessions inherit this session's work. Use when:
Before calling, check: did you record at least one discovery with trw_learn? If not, add even a one-line root-cause learning so the next agent avoids re-discovery. Runs reflect + checkpoint synchronously, then launches housekeeping (consolidation, publish, telemetry, tier sweep) in the background. Background work is concurrency-safe — overlapping batches are skipped rather than queued. Input:
Output: DeliverResultDict with fields {run_path: str, reflect: dict, checkpoint: dict, deferred: str, critical_steps_completed: int, deferred_steps: int, errors: list, success: bool, learning_reflection?: str}. Example: trw_deliver() → {"run_path": "/path/...", "critical_steps_completed": 2, "deferred": "launched", "success": true} See Also: trw_checkpoint, trw_instructions_sync |
| trw_heartbeatA | Refresh the caller's pin heartbeat and append a heartbeat event. Use when:
Rate-limit: if Input:
Output: TrwHeartbeatResultDict — on success {run_id, last_heartbeat_ts, stale_after_ts, age_hours, should_checkpoint, rate_limited}; on missing-pin {error: "no_active_pin", hint: "call trw_init or trw_adopt_run first"}. |
| trw_adopt_runA | Transfer an existing run's pin to the caller's session. Use when:
Guards:
Input:
Output: TrwAdoptRunResultDict with fields {adopted_run_id, previous_pin_key, from_pin_key, to_pin_key, adopted_ts, from_owner_was_live, force_used}. Example: trw_adopt_run(run_path="/repo/.trw/runs//") → {"adopted_run_id": "", "from_pin_key": "sess-a", "to_pin_key": "sess-b", "force_used": false, ...} |
| trw_pre_compact_checkpointA | Capture a safety checkpoint before the context window compacts. Use when:
PRD-CORE-165 FR-01: pass Best-effort: sub-step failures populate Output: PreCompactResultDict with fields {status: "written"|"skipped"|"error", reason?: str, checkpoint_path?: str, instructions_path?: str, compact_state_path?: str, directive?: str, context_anchor?: str}. |
| trw_learnA | Persist a non-obvious discovery so future agents inherit the finding. Use when:
Only record learnings that:
Required:
Recommended:
Advanced (auto-detected if omitted):
Output: LearnResultDict with {id: str, status: "saved"|"deduped"|"error", dedup_match?: dict, ceremony_hint?: str}. See Also: trw_recall, trw_learn_update |
| trw_learn_updateA | Update an existing learning — status, fields, or feedback signal. Use when:
Output: dict with fields {status: "updated"|"not_found"|"invalid", error?: str, field_updated?: str}. |
| trw_recallA | Retrieve prior learnings relevant to your current task. Use when:
See Also: trw_learn, trw_session_start. Results are ranked by combined relevance (query match on summary/tags/detail) and utility (impact, type-aware recency decay, prior feedback). Context boosts prioritize entries matching your current domain, phase, and team. Output: RecallResultDict with fields {learnings: list[{id, summary, detail?, tags, impact, ...}], count: int, query: str, ceremony_hint?: str}. |
| trw_instructions_syncA | Sync TRW protocol and ceremony guidance into the client's instruction file. Use when:
Renders behavioral protocol and ceremony guidance into the auto-generated
block of whichever client surface is present ( Output: ClaudeMdSyncResultDict with fields {status: "success"|"error", files_written: list[str], sections_synced: int}. |
| trw_claude_md_syncA | Deprecated alias for Use when: maintaining backward compatibility with older callers; prefer
Output: same as trw_instructions_sync — ClaudeMdSyncResultDict with fields {status, files_written, sections_synced}. |
| trw_surface_classifyA | Classify a meta-tune surface as control vs advisory. Use when you need to know whether a candidate path is governed by the SAFE-001 control surface registry before promoting a meta-tune proposal. Returns: dict with |
| trw_meta_tune_rollbackA | Roll back a previously promoted meta-tune proposal. Use when a promoted candidate is causing regressions and you need to restore the prior surface content while writing an entry to the SAFE-001 audit log. Returns: dict serialization of the rollback result, including the proposal id and the restored content hash. |
| trw_initA | Create a run directory and register it as the active run. Use when:
Bootstraps state, run metadata, events, framework assets, optional wave/artifact metadata, and a trace/profile-aware task_profile. Input: task_name plus optional objective, config_overrides, task_root, wave_manifest, complexity signals, artifacts, and protection flag. Output: dict with run_id, run_path, task_dir, phase, and status fields. |
| trw_statusA | Report the active run's phase, wave progress, shard state, and last activity. Use when:
Input:
Output: TrwStatusDict with fields {run_id, task, phase, status, confidence, framework, event_count, reflection, waves?, wave_progress?, wave_status?, reversions, last_activity_ts?, hours_since_activity?, stale_count}. |
| trw_checkpointA | Append a progress snapshot so work survives context compaction. Use when:
Input: optional run_path plus required message. Optional shard_id and wave_id annotate delegated or wave-aware progress. Output: dict with status, run_path, checkpoint path, and message metadata. |
| trw_prd_createA | Generate an AARE-F compliant PRD from a feature description. Use when:
Produces 12 standard sections, confidence scores, and traceability links.
Updates INDEX.md/ROADMAP.md when Input:
Output: PrdCreateResultDict with fields {prd_id: str, title: str, category: str, priority: str, output_path: str, content: str, sections_generated: int, index_synced: bool}. Example: trw_prd_create(input_text="Add rate limiting to public API", category="CORE", priority="P1") → {"prd_id": "PRD-CORE-001", "output_path": "docs/requirements-aare-f/prds/PRD-CORE-001.md", "sections_generated": 12, "index_synced": true, ...} See Also: trw_prd_validate |
| trw_prd_validateA | Score a PRD against the V2 validation suite before implementation. Use when:
Runs structure compliance, content quality, AARE-F compliance, and ambiguity analysis. Catches issues here that would otherwise cause rework. Input:
Output: ValidateResultDict with fields {total_score: float (0-100), quality_tier: str, grade: str, valid: bool, ambiguity_rate: float, completeness_score: float, traceability_coverage: float, improvement_suggestions: list[ImprovementSuggestionDict], failures: list[ValidationFailureDict], dimensions: list[DimensionScoreDict], path: str, sections_found: list[str], sections_expected: list[str], smell_findings: list[dict], ears_classifications: list[dict], readability: dict[str, float], section_scores: list[SectionScoreDict], effective_risk_level: str, risk_scaled: bool, status_drift_warnings: list[str], integrity_warnings: list[str], cache: dict}. quality_tier values: "skeleton" | "draft" | "review" | "approved" (QualityTier enum; no "PRODUCTION" tier exists). Example: trw_prd_validate(prd_path="docs/requirements-aare-f/prds/PRD-QUAL-074.md") → {"total_score": 87, "quality_tier": "approved", "grade": "A", "valid": true, "improvement_suggestions": []} |
| trw_reviewA | Compute a structured code-review verdict and persist a review.yaml artifact. Use when:
Modes:
Input:
Output: dict with fields {verdict: "pass"|"warn"|"block", findings_count: int, categories: dict, review_path: str, run_id: str, mode: str}. Example: trw_review(findings=[{"category":"security","severity":"high","description":"..."}]) → {"verdict": "block", "findings_count": 1, "review_path": ".../review.yaml", "mode": "manual"} |
| trw_query_eventsB | Return a merged cross-emitter event view for a session. |
| trw_prd_diffB | Diff two PRD files with requirement, metric, and acceptance-gate focus. Use when:
|
| trw_surface_diffB | Structured diff between two surface snapshots. Returns |
| trw_mcp_security_statusD | – |
| trw_before_edit_hintB | Return cold-start codebase intelligence for Use when an agent is about to edit a file and needs sidecar-backed risk context plus relevant prior learnings before reading broadly. Sources:
Returns BeforeEditHintResult.model_dump() enriched by client tier.
NEVER raises — failure paths populate |
| trw_before_edit_hint_batchA | Return c735+c743 BeforeYouEditBatch for the current SHA. Use when an agent is planning a multi-file edit and needs batched before-edit hints from a persisted trw-distill sidecar. Tier-gated (paid tiers only — see trw_before_edit_hint for the
free-tier learnings counterpart). Returns
|
| trw_codebase_risk_reportA | Return c737/c739 ranked composite-risk report for the current SHA. Use when a reviewer needs file-level structural risk ordering from a persisted trw-distill sidecar before prioritizing review effort. Tier-gated. |
| trw_ordering_compareA | Return c741 RiskOrderingComparison for the current SHA. Use when comparing two persisted risk-ordering sidecars for overlap and rank-correlation drift. Tier-gated. NEVER raises. |
| trw_cross_repo_orderingA | Return the latest c745 CrossRepoOrderingAggregate. Use when comparing structural-risk ordering consistency across multiple repositories from a persisted aggregate sidecar. Sidecar SHA derived from sorted-repo-names (NOT git HEAD), so operator passes sidecar_path/sidecar_dir or the tool searches the repo-default location for the most-recent aggregate. Tier-gated. NEVER raises. |
| trw_code_index_updateA | Update the local SHA-256 code-index manifest. Use when an agent needs a fresh local code-index manifest before code search or symbol analysis without returning file bodies. |
| trw_code_searchA | Search local indexed code chunks. Use when an agent has run |
| trw_code_symbolA | Find local indexed symbols with exact matches ranked first. Use when an agent needs symbol locations from the local code index without scanning or returning full file bodies. |
| trw_entity_risk_mapA | Return entity-level structural risk rows for the current SHA. Use when a reviewer needs symbol/function/class/endpoint blast-radius
triage from a persisted sidecar. Tier-gated. |
| trw_agent_work_evidenceA | Export canonical privacy-safe AgentWorkEvidence for a TRW run. Use when a judge, eval harness, reviewer, or knowledge-graph importer needs one schema-valid work record instead of scraping run internals. |
| trw_validate_agent_work_evidenceA | Validate an AgentWorkEvidence candidate and return structured errors. Use when an external producer or fixture needs schema validation before evidence is accepted by a judge or graph-ingestion pipeline. |
| trw_skill_discoveryA | Rank eligible SKILL.md files without executing them. Use when an agent needs safe skill recommendations from explicit SKILL.md paths before invoking any workflow. |
| trw_submit_feedbackA | Submit a memo to the TRW maintainer (PRD-CORE-182). Use when:
Input:
Output: dict with Never raises — transport and validation failures are reported in the
|
| trw_pipeline_healthA | Probe the five compounding-pipeline signals (sync_push, graph_edges, embedding_coverage, recall_feedback, bandit_state). Returns a structured report with degraded flag and advisory. Use when:
Checks: sync_push (consecutive_failures + last_push_at age), graph_edges (knowledge graph empty?), embedding_coverage (< 10%?), recall_feedback (all recall_count=0?), and bandit_state (mtime stale?). Returns a structured report with:
All probes are read-only and fail-open individually. |
| trw_probeA | Run a bounded, sandboxed experiment to resolve a disputed plan assumption. Use when, during the PLAN phase, two plan branches disagree on a
load-bearing, empirically resolvable claim a rubric cannot adjudicate
(e.g. "this parser handles a 50MB JSONL stream without OOM"). The
Budget is enforced per Returns: dict serialization of |
| trw_probe_budget_statusA | Report live probe budget usage for a session (read-only, FR-10). Use when you need to detect runaway probe usage before it becomes
cost/latency creep. Returns |
| trw_profile_explainA | Explain the resolved profile's per-field layer attribution. Use when:
Resolves the full 6-layer chain (defaults → org → domain → task-type → session → client) and reports, for every surface field, its effective value, the origin layer, and the full override chain. Input (all optional — inferred when omitted):
Output: dict with |
| trw_request_tool_accessA | Grant this session single-use access to a phase-masked tool. Use when a genuine cross-phase or emergency-debug need requires a tool
the current phase masks — and only then, since every grant is logged to
telemetry. The grant is single-use (one subsequent call) and the TTL is
capped at 5 minutes regardless of |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| elicit | Extract and structure requirements from documentation, interviews, or code. AARE-F requirements elicitation — analyzes source material and produces structured requirements with IDs, confidence scores, and traceability links. |
| prd_create | Generate an AARE-F compliant PRD from requirements or feature description. Creates a complete PRD with YAML frontmatter, 12 required sections, confidence scores, and traceability matrix. |
| validate_quality | Validate a PRD against AARE-F quality gates — ambiguity, completeness, consistency. Performs comprehensive quality audit including ambiguity detection, completeness assessment, consistency checking, and traceability verification. |
| resolve_conflicts | Detect and resolve requirement conflicts using AARE-F strategies. Applies risk-based resolution, AHP-TOPSIS scoring, or IBIS structured argumentation depending on conflict type and severity. |
| check_traceability | Analyze traceability coverage — source, implementation, test, and KE links. Identifies traceability gaps, orphan implementations, and missing test coverage against AARE-F C1 standards. |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| get_framework_config | Current framework config — defaults merged with .trw/config.yaml overrides. Returns merged configuration as YAML text. Project-level overrides from .trw/config.yaml take precedence over built-in defaults. |
| get_framework_versions | Deployed framework versions from .trw/frameworks/VERSION.yaml. Returns version information for deployed FRAMEWORK.md and AARE-F-FRAMEWORK.md, including trw-mcp package version and deployment timestamp. |
| get_learnings_summary | High-impact learnings summary from .trw/ — top insights for current session. Returns a formatted summary of high-impact learnings, discovered patterns, and context (architecture + conventions) from .trw/. |
| get_run_state | Current run state (run.yaml) — phase, status, confidence, variables. Returns the contents of the most recently modified run.yaml if an active run is found. Empty string if no active run. |
| get_prd_template | AARE-F PRD template — YAML frontmatter + 12 sections with quality checklist. Returns the full AARE-F-compliant PRD template ready for filling in. Includes confidence scores, traceability matrix, and quality checklist. |
| get_shard_card_template | Shard card YAML template — defines parallel work unit structure. Returns a YAML template for shard cards as defined in FRAMEWORK.md v18.0_TRW section SHARD-CARDS. |
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/wallter/trw-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server