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
| Name | Required | Description | Default |
|---|---|---|---|
| dry_run | No | ||
| source_dir | Yes | ||
| target_dir | No | ||
| auto_approve | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |