Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Exploration Tools

Six tools for intent-aware search, pattern-based scanning, structural hole detection, stacktrace analysis, temporal history, and multi-repository federation.


m1nd.seek

Intent-aware semantic code search. Finds code by purpose, not text pattern. Combines keyword matching, graph activation (PageRank), and trigram similarity for ranking.

Unlike activate (which propagates signal through edges), seek scores every node independently against the query, making it better for finding specific code when you know what it does but not where it lives.

Parameters

ParameterTypeRequiredDefaultDescription
querystringYesNatural language description of what the agent is looking for. Example: "code that validates user credentials".
agent_idstringYesCalling agent identifier.
top_kintegerNo20Maximum results to return.
scopestringNoFile path prefix to limit search scope. Example: "backend/". None = entire graph.
node_typesstring[]No[]Filter by node type: "function", "class", "struct", "module", "file". Empty = all types.
min_scorenumberNo0.1Minimum combined score threshold. Range: 0.0 to 1.0.
graph_rerankbooleanNotrueWhether to run graph re-ranking (PageRank weighting) on candidates. Disable for pure text matching.

Scoring Formula (V1)

combined = keyword_match * 0.6 + graph_activation * 0.3 + trigram * 0.1

V2 upgrade path will replace keyword matching with real embeddings (fastembed-rs + jina-embeddings-v2-base-code).

Example Request

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "m1nd.seek",
    "arguments": {
      "agent_id": "orchestrator",
      "query": "code that validates user credentials",
      "top_k": 5,
      "node_types": ["function", "class"]
    }
  }
}

Example Response

{
  "query": "code that validates user credentials",
  "results": [
    {
      "node_id": "file::auth_discovery.py::fn::validate_credentials",
      "label": "validate_credentials",
      "type": "function",
      "score": 0.87,
      "score_breakdown": {
        "embedding_similarity": 0.92,
        "graph_activation": 0.78,
        "temporal_recency": 0.65
      },
      "intent_summary": "Validates user credentials against provider store",
      "file_path": "backend/auth_discovery.py",
      "line_start": 45,
      "line_end": 82,
      "connections": [
        { "node_id": "file::principal_registry.py", "label": "principal_registry.py", "relation": "calls" }
      ]
    }
  ],
  "total_candidates_scanned": 9767,
  "embeddings_used": false,
  "elapsed_ms": 25.0
}

When to Use

  • “Find the code that does X” – when you know the purpose, not the filename
  • Codebase onboarding – exploring unfamiliar code by intent
  • Pre-modification search – find all code related to a feature before changing it
  • m1nd.activate – graph-propagation search (better for exploring neighborhoods)
  • m1nd.scan – pattern-based structural analysis (finds anti-patterns, not features)

m1nd.scan

Pattern-aware structural code analysis with graph-validated findings. Detects structural issues using predefined patterns, then validates each finding against the graph to filter false positives. Works across file boundaries.

Parameters

ParameterTypeRequiredDefaultDescription
patternstringYesPattern ID or custom pattern string. Built-in patterns: "error_handling", "resource_cleanup", "api_surface", "state_mutation", "concurrency", "auth_boundary", "test_coverage", "dependency_injection".
agent_idstringYesCalling agent identifier.
scopestringNoFile path prefix to limit scan scope.
severity_minnumberNo0.3Minimum severity threshold. Range: 0.0 to 1.0.
graph_validatebooleanNotrueValidate findings against graph edges (cross-file analysis). Disable for raw pattern matching only.
limitintegerNo50Maximum findings to return.

Example Request

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "m1nd.scan",
    "arguments": {
      "agent_id": "orchestrator",
      "pattern": "error_handling",
      "scope": "backend/",
      "severity_min": 0.5
    }
  }
}

Example Response

{
  "pattern": "error_handling",
  "findings": [
    {
      "pattern": "error_handling",
      "status": "confirmed",
      "severity": 0.78,
      "node_id": "file::worker.py::fn::spawn_agent",
      "label": "spawn_agent",
      "file_path": "backend/worker.py",
      "line": 89,
      "message": "Bare except clause catches all exceptions including KeyboardInterrupt",
      "graph_context": [
        { "node_id": "file::process_manager.py", "label": "process_manager.py", "relation": "calls" }
      ]
    }
  ],
  "files_scanned": 77,
  "total_matches_raw": 23,
  "total_matches_validated": 8,
  "elapsed_ms": 150.0
}

Finding Status Values

StatusMeaning
"confirmed"Graph validation confirms the issue is real
"mitigated"The issue exists but is handled by a related module
"false_positive"Graph context shows the pattern match is not actually an issue

When to Use

  • Code quality audit – scan for anti-patterns across the codebase
  • Security review – use "auth_boundary" to find auth bypass paths
  • Pre-deploy check – scan for "error_handling" and "resource_cleanup" issues
  • Test gaps – use "test_coverage" to find untested code

m1nd.missing

Detect structural holes and missing connections. Given a topic query, finds areas where the graph suggests something should exist but does not. Identifies absent abstractions, missing connections, and incomplete patterns.

Parameters

ParameterTypeRequiredDefaultDescription
querystringYesSearch query to find structural holes around.
agent_idstringYesCalling agent identifier.
min_sibling_activationnumberNo0.3Minimum sibling activation threshold. Siblings with activation below this are not considered for hole detection.

Example Request

{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "m1nd.missing",
    "arguments": {
      "agent_id": "orchestrator",
      "query": "database connection pooling",
      "min_sibling_activation": 0.3
    }
  }
}

Example Response

{
  "query": "database connection pooling",
  "holes": [
    {
      "node_id": "structural_hole_1",
      "label": "connection lifecycle",
      "type": "structural_hole",
      "reason": "No dedicated connection pool abstraction -- 4 adjacent modules manage connections independently"
    },
    {
      "node_id": "structural_hole_2",
      "label": "pool metrics",
      "type": "structural_hole",
      "reason": "No pool health monitoring -- 3 adjacent modules expose metrics but pool does not"
    }
  ],
  "total_holes": 9,
  "elapsed_ms": 67.0
}

When to Use

  • Gap analysis – “what am I missing?” before implementing a feature
  • Pre-spec – identify areas that need design before building
  • Architecture review – find missing abstractions or connections
  • Feature completeness – after building, check for structural holes around the feature
  • m1nd.activate – activate with include_structural_holes: true for inline hole detection
  • m1nd.hypothesize – test a specific claim about missing structure

m1nd.trace

Map runtime errors to structural root causes via stacktrace analysis. Parses the stacktrace, maps frames to graph nodes, and scores each node’s suspiciousness using trace depth, modification recency, and centrality. Also finds co-change suspects (files modified around the same time as the top suspect).

Parameters

ParameterTypeRequiredDefaultDescription
error_textstringYesFull error output (stacktrace + error message).
agent_idstringYesCalling agent identifier.
languagestringNoLanguage hint: "python", "rust", "typescript", "javascript", "go". Auto-detected if omitted.
window_hoursnumberNo24.0Temporal window (hours) for co-change suspect scan.
top_kintegerNo10Max suspects to return.

Example Request

{
  "jsonrpc": "2.0",
  "id": 4,
  "method": "tools/call",
  "params": {
    "name": "m1nd.trace",
    "arguments": {
      "agent_id": "orchestrator",
      "error_text": "Traceback (most recent call last):\n  File \"backend/handler.py\", line 234, in handle_message\n  File \"backend/pool.py\", line 89, in acquire\n  File \"backend/worker.py\", line 156, in submit\nTimeoutError: pool exhausted",
      "language": "python",
      "top_k": 5
    }
  }
}

Example Response

{
  "language_detected": "python",
  "error_type": "TimeoutError",
  "error_message": "pool exhausted",
  "frames_parsed": 3,
  "frames_mapped": 3,
  "suspects": [
    {
      "node_id": "file::worker.py::fn::submit",
      "label": "submit",
      "type": "function",
      "suspiciousness": 0.91,
      "signals": { "trace_depth_score": 1.0, "recency_score": 0.85, "centrality_score": 0.88 },
      "file_path": "backend/worker.py",
      "line_start": 150,
      "line_end": 175,
      "related_callers": ["pool.py::acquire"]
    },
    {
      "node_id": "file::pool.py::fn::acquire",
      "label": "acquire",
      "type": "function",
      "suspiciousness": 0.78,
      "signals": { "trace_depth_score": 0.67, "recency_score": 0.72, "centrality_score": 0.65 },
      "file_path": "backend/pool.py",
      "line_start": 80,
      "line_end": 110,
      "related_callers": ["handler.py::handle_message"]
    }
  ],
  "co_change_suspects": [
    { "node_id": "file::config.py", "label": "config.py", "modified_at": 1710295000.0, "reason": "Modified within 2h of top suspect" }
  ],
  "causal_chain": ["worker.py::submit", "pool.py::acquire", "handler.py::handle_message"],
  "fix_scope": {
    "files_to_inspect": ["backend/worker.py", "backend/pool.py", "backend/config.py"],
    "estimated_blast_radius": 23,
    "risk_level": "medium"
  },
  "unmapped_frames": [],
  "elapsed_ms": 3.5
}

Suspiciousness Scoring

SignalWeightDescription
trace_depth_scoreHigh1.0 = deepest frame (most specific); decays linearly
recency_scoreMediumExponential decay from last modification time
centrality_scoreMediumNormalized PageRank centrality

When to Use

  • Bug investigation – paste an error and get ranked suspects
  • Root cause analysis – the causal chain shows the error propagation path
  • Fix scopingfix_scope tells you which files to inspect and the risk level

m1nd.timeline

Git-based temporal history for a node. Returns the change history, co-change partners, velocity, stability score, and churn data for a specific file or module.

Parameters

ParameterTypeRequiredDefaultDescription
nodestringYesNode external_id. Example: "file::backend/handler.py".
agent_idstringYesCalling agent identifier.
depthstringNo"30d"Time depth. Values: "7d", "30d", "90d", "all".
include_co_changesbooleanNotrueInclude co-changed files with coupling scores.
include_churnbooleanNotrueInclude lines added/deleted churn data.
top_kintegerNo10Max co-change partners to return.

Example Request

{
  "jsonrpc": "2.0",
  "id": 5,
  "method": "tools/call",
  "params": {
    "name": "m1nd.timeline",
    "arguments": {
      "agent_id": "orchestrator",
      "node": "file::backend/handler.py",
      "depth": "30d",
      "top_k": 5
    }
  }
}

Example Response

{
  "node": "file::backend/handler.py",
  "depth": "30d",
  "changes": [
    {
      "date": "2026-03-10",
      "commit": "a1b2c3d",
      "author": "cosmophonix",
      "delta": "+45/-12",
      "co_changed": ["parser.py", "chat_routes.py"]
    },
    {
      "date": "2026-03-05",
      "commit": "e4f5g6h",
      "author": "cosmophonix",
      "delta": "+120/-30",
      "co_changed": ["pool.py", "worker.py"]
    }
  ],
  "co_changed_with": [
    { "file": "parser.py", "times": 8, "coupling_degree": 0.72 },
    { "file": "chat_routes.py", "times": 6, "coupling_degree": 0.55 },
    { "file": "pool.py", "times": 4, "coupling_degree": 0.38 }
  ],
  "velocity": "accelerating",
  "stability_score": 0.35,
  "pattern": "churning",
  "total_churn": { "lines_added": 580, "lines_deleted": 120 },
  "commit_count_in_window": 12,
  "elapsed_ms": 45.0
}

Velocity Values

ValueMeaning
"accelerating"Change frequency is increasing
"decelerating"Change frequency is decreasing
"stable"Consistent change rate

Pattern Values

ValueMeaning
"expanding"Growing (net positive churn)
"shrinking"Reducing (net negative churn)
"churning"High add+delete with little net growth
"dormant"Few or no changes in the window
"stable"Small, consistent changes

When to Use

  • Hotspot detection – find files that change too frequently (stability_score < 0.3)
  • Co-change discovery – find files that always change together (coupling_degree > 0.6)
  • Refactoring signals – churning files may need redesign
  • m1nd.diverge – structural drift across the whole codebase
  • m1nd.predict – predict co-changes for a given modification

m1nd.federate

Ingest multiple repositories into a unified federated graph with automatic cross-repo edge detection. After federation, all existing query tools (activate, impact, why, etc.) traverse cross-repo edges automatically.

Node IDs in the federated graph use {repo_name}::file::path format.

Parameters

ParameterTypeRequiredDefaultDescription
agent_idstringYesCalling agent identifier.
reposobject[]YesList of repositories to federate. Each object has: name (string, required – namespace prefix), path (string, required – absolute path), adapter (string, default "code").
detect_cross_repo_edgesbooleanNotrueAuto-detect cross-repo edges: config, API, import, type, deployment, MCP contract.
incrementalbooleanNofalseOnly re-ingest repos that changed since last federation.

Cross-Repo Edge Types

Edge TypeDescription
shared_configTwo repos reference the same configuration key
api_contractOne repo’s API client matches another’s API server
package_depDirect package dependency
shared_typeSame type/interface definition used across repos
deployment_depDeployment configuration dependency
mcp_contractMCP tool consumer/provider relationship

Example Request

{
  "jsonrpc": "2.0",
  "id": 6,
  "method": "tools/call",
  "params": {
    "name": "m1nd.federate",
    "arguments": {
      "agent_id": "orchestrator",
      "repos": [
        { "name": "backend", "path": "/project/backend" },
        { "name": "frontend", "path": "/project/frontend" },
        { "name": "mcp-server", "path": "/project/mcp-server", "adapter": "code" }
      ],
      "detect_cross_repo_edges": true,
      "incremental": false
    }
  }
}

Example Response

{
  "repos_ingested": [
    { "name": "backend", "path": "/project/backend", "node_count": 9767, "edge_count": 26557, "from_cache": false, "ingest_ms": 910.0 },
    { "name": "frontend", "path": "/project/frontend", "node_count": 1200, "edge_count": 3500, "from_cache": false, "ingest_ms": 320.0 },
    { "name": "mcp-server", "path": "/project/mcp-server", "node_count": 250, "edge_count": 680, "from_cache": false, "ingest_ms": 85.0 }
  ],
  "total_nodes": 11217,
  "total_edges": 30737,
  "cross_repo_edges": [
    {
      "source_repo": "frontend",
      "target_repo": "backend",
      "source_node": "frontend::file::src/lib/apiConfig.ts",
      "target_node": "backend::file::main.py",
      "edge_type": "api_contract",
      "relation": "calls_api",
      "weight": 0.85,
      "causal_strength": 0.72
    },
    {
      "source_repo": "mcp-server",
      "target_repo": "backend",
      "source_node": "mcp-server::file::src/mcp-server.js",
      "target_node": "backend::file::main.py",
      "edge_type": "mcp_contract",
      "relation": "calls_api",
      "weight": 0.78,
      "causal_strength": 0.65
    }
  ],
  "cross_repo_edge_count": 18203,
  "incremental": false,
  "skipped_repos": [],
  "elapsed_ms": 1315.0
}

When to Use

  • Multi-repo projects – analyze dependencies across frontend, backend, and infrastructure repos
  • Monorepo decomposition – understand how packages depend on each other
  • API impact analysis – find which repos are affected by an API change
  • m1nd.ingest – single-repo ingestion
  • m1nd.impact – blast radius analysis (works across federated repos)
  • m1nd.why – path explanation (traverses cross-repo edges)