Skip to main content
Glama

btb_derive_governed

Analyze a directory to discover latent file structure with Ward clustering and propose a governed reorganization enforced by approval gates, with dry-run analysis before moving files.

Instructions

Execute a governed derive operation on a directory.

Discovers latent filesystem structure using Ward clustering and proposes reorganization with mandatory governance gates. This is the core capability from back-to-the-basics, wrapped in the threshold-protocols governance circuit.

Args: source_dir: Directory containing files to analyze and organize. Can be relative to BTB root or absolute path. target_dir: Destination for organized files. Default: {source_dir}/organized dry_run: If True, analyze and propose but don't move files. If False, execute after approval (default: True). auto_approve: If True, auto-pass approval gates (for testing). If False, requires btb_derive_approve() call.

Returns: JSON result with: - proposal: Discovered schema and reorganization plan - phase: Current operation phase - approval_required: Whether approval needed before execution - proposal_hash: Hash to use with btb_derive_approve() - governance: Circuit result summary

Security: Only operates within BTB or specified source directory. Governance: All operations pass through Detection → Simulation → Deliberation → Intervention circuit.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "source_dir": "<source_dir>"
    },
    "name": "btb_derive_governed"
  }
}

Input Schema

NameRequiredDescriptionDefault
dry_runNo
source_dirYes
target_dirNo
auto_approveNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full behavioral burden and does so well: it discloses the security boundary ('Only operates within BTB or specified source directory'), the four-stage governance circuit every operation passes through, and the approval gating semantics. It omits whether file moves are reversible, what happens to files on partial failure, and whether approval can expire — meaningful gaps for a mutating operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The opening two sentences are well front-loaded, but the Args/Returns blocks largely restate the input schema and enumerate return fields that an output schema already defines, and the 'core capability from back-to-the-basics' branding does no work for an agent. The Security/Governance lines are the highest-value content and are buried at the bottom.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a governed mutating tool with no annotations and four parameters, the definition covers scope, approval workflow, and the execution phases an agent will observe. The remaining gap is failure and reversibility behavior, which matters given the tool can move files on disk.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, and it does: all four parameters are explained, including the derived default for target_dir ({source_dir}/organized), the relative-vs-absolute path convention for source_dir, the analyze-vs-execute split for dry_run, and the testing-only nature of auto_approve. It does not explain what the returned proposal_hash is derived from or how long it stays valid.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Execute a governed derive operation on a directory') and explains the mechanism ('Ward clustering', 'proposes reorganization with mandatory governance gates'). It also distinguishes itself from the approval sibling by naming btb_derive_approve() as the required next step when auto_approve is False.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives concrete conditional guidance: dry_run=True analyzes and proposes without moving files, dry_run=False executes after approval, and auto_approve=True is reserved for testing while False requires a btb_derive_approve() call. It does not state when to prefer a plain directory listing or status check over running a derive, so it stops short of full alternative routing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.