| build_project_contextA | Returns repository-wide context or a selected context view without persisting an index; distinguishing from 'build_ast_snapshot' which writes a cache and 'generate_architectural_passport' which analyzes one Python file. Parameters: project_root: File system directory path; accepts relative or absolute paths, resolving symlinks and automatically skipping .git, node_modules, venv, and binary artifacts.
context_type: Structural format selector: 'tree' emits full 4-tier AST architecture; 'repo_map' builds compact PageRank-ranked symbol table; 'skeleton' outputs target file implementation with 1st-degree callers/callees; 'zero_waste_prompt' formats prompt-ready AST prefix; 'incremental_diff' isolates git diff context.
focus_file: Relative or absolute file path to anchor 1st-degree dependency skeletons when context_type is 'skeleton' or 'incremental_diff'; ignored when context_type is 'tree'.
reduction_mode: AST pruning depth: 'ultra' preserves type signatures, classes, methods, and docstrings while removing function bodies (80-95% compression); 'balanced' retains control-flow branch headers; 'none' includes raw source code without pruning.
max_tokens: Soft token ceiling (1,000 to 128,000); tree generation prioritizes core architectural layers and truncates leaf utility modules first if budget binds.
include_file_contents: Set True to append AST-pruned source bodies; set False for pure directory and class hierarchy outlines with lowest token footprint.
Behavior: Mutability: Strictly read-only; reads filesystem AST without modifying files, caches, or disk state. Idempotency: Deterministic; identical workspace revisions yield bit-for-bit identical context payloads. Privacy & Network: 100% offline local processing; zero cloud API calls, telemetry, or external network egress. Performance & Resources: Executes in <500ms for 500 files consuming <50MB RAM; thread-safe with zero rate limits. Auth: Zero authentication, API keys, or cloud credentials required. Return Structure: Emits complete Markdown document with '# Repository Architecture', '# Module Dependencies', and token telemetry; no pagination required. Error Handling: Returns non-crashing warning document with troubleshooting steps if path is empty or contains no supported language source files.
Usage Guidelines: When to use: Ingest codebase architecture, symbol tables, focus file skeletons, or zero-waste prompt context at the start of an agent session or major refactor to save 80-95% context tokens. When NOT to use: Do not use for stripping implementation bodies from an in-memory code string or diff patch (use 'prune_code_snippet' instead); do not use for targeted keyword or semantic identifier lookup across code (use 'search_codebase' instead).
Returns: Structured Markdown document featuring '# Repository Architecture (T-1)', '# Module Dependencies (T-2)', '# AST Signatures (T-3)', '# Architectural Rules (T-4)', and quantitative token savings metrics. |
| prune_code_snippetA | Prunes implementation bodies from in-memory code snippets, API schemas, or unified diff streams while preserving AST interfaces, type annotations, and function signatures, distinguishing from 'build_project_context' and 'audit_code_quality' by stripping function bodies in memory rather than scanning repository file trees or auditing code quality. Parameters: code (str, required): Raw source code, schema definition (JSON/YAML), or unified diff text to compress.
file_name_or_lang (str, optional, default='snippet.py'): File name or language extension (e.g. 'service.ts', '.go', '.rs', 'schema.json') to select appropriate AST parser.
reduction_mode (str, optional, default='ultra'): AST reduction level: 'ultra' for signatures only, 'balanced' for signatures + control structures, 'micro_patch' for surgical unified diff pruning.
Behavior: Read-only: Processes in-memory text buffers without touching disk files. Idempotent: Deterministic AST reduction for identical code inputs. 100% Offline: Local AST and regex parsers for Python, TypeScript, Go, Rust, Java, C#, C++, SQL, JSON, YAML. Auth & Rate Limits: Zero authentication or credentials required; execution latency <10ms. Error Handling: Gracefully falls back to regex line pruning if parser encounters malformed syntax.
Usage Guidelines: When to use: Compress raw code strings, function definitions, SQL queries, or diff patches before embedding them in an LLM prompt to achieve 80-95% token savings. When NOT to use: Do not use for scanning full repository files or building hierarchical project context from disk (use 'build_project_context' instead); do not use for detecting code duplication across modules (use 'audit_code_quality' instead).
Returns: Compact code snippet retaining only structural signatures, interfaces, and docstrings. |
| manage_architecture_rulesA | Manages the persistent lifecycle of architectural boundary rules and tier constraints in tzero.rules.json, distinguishing from 'enforce_architecture_rules' and 'generate_architecture_blueprint' by configuring layer definitions on disk rather than evaluating codebase compliance or generating visual diagrams. Parameters: action: Rule lifecycle operation: 'query' inspects active boundary definitions; 'update' creates or overwrites rule configurations; 'delete' removes a specified rule; 'reset' restores enterprise-default 4-tier rules.
project_root: Directory path containing or intended to hold tzero.rules.json; defaults to current working directory.
rule_name: Specific rule identifier or layer name (e.g. 'presentation', 'domain', 'persistence', 'forbidden_imports') to target during 'update' or 'delete'.
rule_definition: Valid JSON string or Markdown specification defining layer constraints, allowed imports, or forbidden cross-tier dependencies when action is 'update'.
Behavior: Mutability: State-modifying; writes and updates tzero.rules.json on disk when action is 'update', 'delete', or 'reset'; read-only when action is 'query'. Idempotency: Idempotent for identical rule definitions and queries; resets restore canonical default JSON. Privacy & Network: 100% offline local filesystem storage; zero cloud synchronization or external dependencies. Performance & Resources: Executes in <20ms; atomic file writing prevents file corruption during concurrent operations. Auth: Zero authentication or cloud credentials required. Return Structure: Emits JSON or Markdown status confirmation of updated, deleted, or queried boundary configurations. Error Handling: Validates JSON syntax before writing to disk; emits clear error diagnostics on malformed JSON without modifying existing rules.
Usage Guidelines: When to use: Configure, inspect, update, reset, or remove architectural layer definitions and dependency constraints (e.g. preventing presentation layer from importing persistence layer). When NOT to use: Do not use for validating whether existing codebase files violate these rules (use 'enforce_architecture_rules' instead); do not use for rendering Mermaid architecture diagrams (use 'generate_architecture_blueprint' instead).
Returns: JSON or Markdown status report detailing active or updated architectural rules and confirmation of modified file path. |
| enforce_architecture_rulesA | Validates codebase import graphs against architectural boundary rules defined in tzero.rules.json, distinguishing from 'manage_architecture_rules' and 'analyze_code_dependencies' by enforcing layer isolation compliance rather than configuring boundary definitions or tracing raw symbol calls. Parameters: project_root: Repository root directory to inspect; scans all source files against configured architectural rules.
strict_mode: When True, treats any forbidden cross-layer import or circular dependency as a critical violation; when False, reports infractions as non-fatal warnings for exploratory audits.
Behavior: Mutability: Strictly read-only; parses import statements across the workspace without altering any files or configurations. Idempotency: Deterministic; identical codebase revisions produce identical violation reports. Privacy & Network: 100% offline local AST parsing; zero cloud telemetry or external network calls. Performance & Resources: Completes in <300ms for 1,000 modules using <40MB RAM; thread-safe with zero rate limits. Auth: Zero authentication or cloud credentials required. Return Structure: Emits structured Markdown compliance audit listing passed layers, detected boundary violations, and exact offending source lines. Error Handling: If tzero.rules.json is missing, applies enterprise standard layer boundaries (presentation -> domain -> persistence) and warns the user.
Usage Guidelines: When to use: Run in CI/CD pipelines, pre-commit hooks, or before merging pull requests to prevent architectural erosion, circular imports, and unauthorized layer coupling. When NOT to use: Do not use for defining, editing, or deleting architectural boundary rules (use 'manage_architecture_rules' instead); do not use for extracting raw caller/callee trees (use 'analyze_code_dependencies' instead).
Returns: Detailed compliance audit report listing passed layer boundaries, identified architectural violations, and remediation guidance. |
| generate_architecture_blueprintA | Generates a complete system architectural specification (ARCHITECTURE.md) with auto-generated Mermaid component topology diagrams, layer boundaries, and module hierarchies, distinguishing from 'enforce_architecture_rules' and 'analyze_code_dependencies' by producing comprehensive system architecture documentation rather than verifying boundary rules or tracing call chains. Parameters: project_root (str, optional, default='.'): Root directory of the repository to analyze (default: current directory).
use_ai (bool, optional, default=False): When True, uses configured AI provider to synthesize deep narrative; when False (default), runs 100% offline AST analysis.
model (str, optional, default=''): Optional model identifier override when use_ai is True.
Behavior: Read-only: Returns formatted Markdown text without writing files to disk. Idempotent: Deterministic AST topology diagram generation when use_ai=False. 100% Offline by default: Runs local AST analysis; optionally uses configured AI model when use_ai=True. Auth & Rate Limits: Zero credentials required for default offline mode; completes in <1s. Error Handling: Falls back to offline AST structural mapping if remote AI model synthesis is unreachable.
Usage Guidelines: When to use: Create or update system architecture documentation and visual Mermaid flow diagrams for onboarding or RFC review. When NOT to use: Do not use for checking rule compliance against defined boundaries (use 'enforce_architecture_rules' instead); do not use for raw dependency listings or call chain traces (use 'analyze_code_dependencies' instead).
Returns: Comprehensive Markdown document with live Mermaid diagrams, layer classifications, and component interfaces. |
| analyze_code_dependenciesA | Analyzes module import graphs, symbol call chains, PageRank graph centrality, and dead code across polyglot source files, distinguishing from 'analyze_change_impact' and 'enforce_architecture_rules' by performing global dependency structure mapping rather than calculating change blast radius or verifying layer boundaries. Parameters: analysis_type: Structural analysis mode: 'dependencies' builds full inbound/outbound module import graph; 'call_chain' traces deep upstream callers and downstream callees; 'pagerank' computes architectural centrality rankings; 'dead_code' detects unreferenced functions and classes.
project_root: Repository root directory path to scan and construct the dependency graph from.
target_symbol: Specific function, method, or class name to trace when analysis_type is 'call_chain'; ignored for other modes.
file_path: Optional file path to scope module dependency analysis to a single file rather than the entire repository.
Behavior: Mutability: Strictly read-only; inspects source syntax trees without modifying, moving, or deleting files. Idempotency: Deterministic; returns identical graph structures and rankings for the same codebase state. Privacy & Network: 100% offline local parsing for Python, TypeScript, JavaScript, Go, Rust, Java, C#, C++; zero network calls. Performance & Resources: Analyzes 1,000 files in <600ms consuming <60MB RAM; thread-safe. Auth: Zero authentication or cloud credentials required. Return Structure: Emits structured Markdown report detailing adjacency lists, Mermaid call diagrams, PageRank scores, or dead-code candidates. Error Handling: Returns clean warning notices if target_symbol is not found in the AST index or if specified file path is missing.
Usage Guidelines: When to use: Inspect inbound dependents, outbound dependencies, deep symbol call sequences, module importance ranks, or dead code prior to major refactoring. When NOT to use: Do not use for calculating the blast radius score of modifying a specific function (use 'analyze_change_impact' instead); do not use for verifying compliance with layer boundary rules (use 'enforce_architecture_rules' instead).
Returns: Markdown report detailing import graphs, call chains, centrality rankings, or detected dead code. |
| analyze_change_impactA | Calculates change blast radius score (0-100) and identifies downstream dependents before modifying or deleting a target function, class, or module, distinguishing from 'analyze_code_dependencies' and 'audit_code_quality' by calculating targeted refactoring risk scores rather than mapping overall import graphs or profiling code complexity. Parameters: target_symbol (str, required): Name of the function, class, or method being modified or refactored.
project_root (str, optional, default='.'): Root directory of the repository (default: current directory).
file_path (str, optional, default=''): Optional file path where the target symbol is defined.
Behavior: Read-only: Scans workspace AST and dependency graphs; does not alter files. Idempotent: Deterministic blast radius scoring for identical repository states. 100% Offline: Local AST caller/callee traversal without remote API calls. Auth & Rate Limits: Zero authentication or API keys required; completes in <300ms. Error Handling: Returns 0 blast radius and not-found notice if the target symbol does not exist in AST index.
Usage Guidelines: When to use: Run prior to editing a core interface, signature, or shared utility to gauge how many downstream files and tests will be impacted. When NOT to use: Do not use for general whole-repository dependency mapping or PageRank centrality (use 'analyze_code_dependencies' instead); do not use for auditing static code complexity and code smells (use 'audit_code_quality' instead).
Returns: Markdown report with quantitative blast radius score (0-100), risk tier (LOW/MEDIUM/HIGH/CRITICAL), affected downstream modules, and test recommendations. |
| search_codebaseA | Executes private local hybrid search combining BM25 keyword matching and TF-IDF semantic scoring across repository code, distinguishing from 'query_memory_store' and 'build_project_context' by indexing source code identifiers and docstrings rather than querying agent episodic memory or generating context trees. Parameters: query: Free-text search phrase, function name, class identifier, or concept description to search across the codebase.
project_root: Directory path of the repository to index and search; defaults to current working directory.
top_k: Maximum count of ranked results to return (integer between 1 and 20; defaults to 5).
Behavior: Mutability: Strictly read-only; queries local files without altering code or persisting external indices on disk. Idempotency: Deterministic; identical queries against the same codebase state produce identical rankings. Privacy & Network: 100% offline local CPU execution; zero remote embedding APIs, cloud billing, or network egress. Performance & Resources: Sub-millisecond query latency (<15ms) across 1,000 files with <35MB RAM footprint; thread-safe. Auth: Zero authentication, API keys, or cloud credentials required. Return Structure: Emits ranked Markdown list with file paths, matching line ranges, relevance scores, and code snippet extracts. Error Handling: Returns clean empty-match notice with suggested query terms if no relevant tokens or symbols match.
Usage Guidelines: When to use: Quickly locate functions, classes, definitions, or architectural concepts in a repository using natural language or symbol names at zero cost. When NOT to use: Do not use for querying persistent agent semantic memory or causal decision graphs (use 'query_memory_store' instead); do not use for building full hierarchical context trees (use 'build_project_context' instead).
Returns: Ranked list of matching code snippets with file paths, line ranges, relevance scores, and matched symbol definitions. |
| audit_code_qualityA | Performs AST static code smell analysis, cyclomatic complexity profiling, copy-paste duplicate detection, and hallucination validation, distinguishing from 'verify_security_guard' and 'analyze_code_dependencies' by scanning code maintainability and complexity rather than checking for credential leaks or analyzing module dependencies. Parameters: project_root: Root directory of the repository to audit; scans supported source files recursively.
check_type: Audit scope selector: 'all' performs full comprehensive audit; 'smells' profiles cyclomatic complexity, method length (>30 lines), and argument counts (>5); 'duplicity' detects copy-pasted blocks (6+ identical lines); 'hallucinations' validates import existence and function call signatures against repository AST.
file_path: Optional path to scope audit to a single source file rather than scanning the full workspace.
Behavior: Mutability: Strictly read-only; parses syntax trees without modifying or deleting files. Idempotency: Deterministic; returns identical diagnostic findings for the same codebase state. Privacy & Network: 100% offline local AST parsing; zero external linter dependencies or network requests. Performance & Resources: Audits 1,000 files in <500ms using <50MB RAM; thread-safe with zero rate limits. Auth: Zero authentication or cloud credentials required. Return Structure: Emits diagnostic Markdown report categorized by severity (T-001 to T-004) with exact file line numbers and remediation suggestions. Error Handling: Skips unparseable binary files gracefully and continues auditing remaining source files.
Usage Guidelines: When to use: Run before submitting PRs, merging branches, or refactoring code to detect complex methods, missing docstrings, duplicate code blocks, or invalid hallucinated imports. When NOT to use: Do not use for detecting hardcoded secrets or installing git pre-commit security hooks (use 'verify_security_guard' instead); do not use for mapping whole-repository module dependencies (use 'analyze_code_dependencies' instead).
Returns: Comprehensive diagnostic report with severity ratings (T-001 to T-004), exact file line references, and remediation guidance. |
| verify_security_guardA | Scans workspace files and code buffers for hardcoded secrets and API keys, or installs the automated git pre-commit zero-leak guard, distinguishing from 'audit_code_quality' and 'enforce_architecture_rules' by identifying high-entropy credentials and git hooks rather than checking code complexity or enforcing layer rules. Parameters: action: Security action: 'scan' inspects workspace files or in-memory text for confidential credentials; 'install_pre_commit' installs the automated git pre-commit security hook into .git/hooks/pre-commit.
project_root: Root directory of the repository to scan or install the pre-commit hook into.
content: Optional raw in-memory code string or configuration text to scan for secrets directly without touching disk files.
Behavior: Mutability: Strictly read-only when action is 'scan'; writes executable hook file .git/hooks/pre-commit when action is 'install_pre_commit'. Idempotency: Scans are strictly idempotent; hook installation is idempotent and will not overwrite custom existing hooks without backup. Privacy & Network: 100% offline local regex and Shannon entropy calculation; zero secret tokens are ever transmitted over the network. Performance & Resources: Scans 1,000 files in <100ms using <30MB RAM; hook execution completes in <50ms. Auth: Zero authentication or cloud credentials required. Return Structure: Emits security audit report showing 100% Zero-Leak pass status or lists detected secret leaks with file names, line numbers, and redacted tokens. Error Handling: Gracefully reports if directory is not a git repository when attempting pre-commit installation.
Usage Guidelines: When to use: Ensure zero confidential credentials (OpenAI, Anthropic, Gemini, GitHub tokens, AWS keys, private certificates) are committed to git or exposed in LLM prompt contexts. When NOT to use: Do not use for checking code quality, cyclomatic complexity, or duplicate code (use 'audit_code_quality' instead); do not use for enforcing architectural layer boundaries (use 'enforce_architecture_rules' instead).
Returns: Security audit report showing 100% Zero-Leak certification or list of detected secret leaks with line numbers, or hook installation confirmation. |
| estimate_token_costA | Calculates exact token counts, comparative API billing costs across major model families, and cumulative financial ROI savings, distinguishing from 'build_project_context' and 'prune_code_snippet' by evaluating financial costs and token metrics rather than constructing context trees or pruning code. Parameters: text (str, optional, default=''): Raw text string to count tokens and calculate cost for.
project_root (str, optional, default='.'): Root directory of the repository to calculate workspace ROI savings for.
tokens (int, optional, default=0): Optional raw token count to calculate cost directly.
export_agent_rules (str, optional, default=''): Optional format to export agent rules: 'cursorrules', 'clinerules', 'markdown', or empty for cost estimation only.
Behavior: Read-only: Calculates metrics from text or token counts without disk modifications. Idempotent: Deterministic pricing calculations based on standard provider pricing tables. 100% Offline: Local pricing lookup table; zero network calls. Auth & Rate Limits: Zero authentication or credentials required; execution latency <5ms. Error Handling: Handles empty input gracefully by returning default workspace token estimations.
Usage Guidelines: When to use: Evaluate token consumption, forecast monthly LLM API expenditures, or export agent rule configuration files (.cursorrules, .clinerules). When NOT to use: Do not use for actively reducing token consumption by pruning repository code into AST signatures (use 'build_project_context' or 'prune_code_snippet' instead).
Returns: Markdown comparison table detailing input/output token counts, estimated USD costs per model provider, and percentage token reduction ROI. |
| query_memory_storeA | Queries semantic triples, causal reasoning graphs, and MinHash entity clusters from the local agent memory store, distinguishing from 'manage_memory_store' and 'search_codebase' by retrieving episodic reasoning relations rather than modifying memory records or searching repository code. Parameters: query: Entity identifier, concept keyword, or natural language query to look up in the persistent semantic memory graph.
query_mode: Query strategy: 'semantic' for knowledge triple and relation lookup; 'causal_chain' for temporal cause-and-effect traces; 'minhash' for sub-microsecond entity similarity clustering.
project_root: Workspace root directory where the local memory store JSON file is located (defaults to current directory).
Behavior: Mutability: Strictly read-only; queries persistent memory store without altering stored knowledge, weights, or timestamps. Idempotency: Deterministic; returns consistent knowledge relations for identical queries on the same memory state. Privacy & Network: 100% offline local graph and MinHash index lookup; zero cloud synchronization or network traffic. Performance & Resources: Query latency <10ms for 10,000 triples using <25MB RAM; thread-safe. Auth: Zero authentication, API keys, or cloud credentials required. Return Structure: Emits Markdown report with extracted semantic triples, knowledge relationships, or causal inference chains. Error Handling: Returns clean empty graph notice if the queried entity does not exist in the codebook without raising exceptions.
Usage Guidelines: When to use: Recall past agent decisions, query knowledge graph entity relations, or trace causal dependency chains across reasoning sessions. When NOT to use: Do not use for storing, consolidating, or deleting memory stores (use 'manage_memory_store' instead); do not use for searching source code in the repository (use 'search_codebase' instead).
Returns: Markdown report with extracted semantic triples, graph relationships, or causal inference chains. |
| manage_memory_storeA | Manages the complete lifecycle of persistent agent semantic memory stores, including compression, consolidation, export, listing, reset, and deletion, distinguishing from 'query_memory_store' and 'prune_code_snippet' by storing, compressing, and purging episodic memories rather than querying relations or pruning source code. Parameters: operation: Memory lifecycle operation: 'list' displays active memory stores and recent codes; 'compress' encodes text into semantic triples; 'decompress' decodes memory codes; 'consolidate' merges episodic memories; 'export' dumps graph to JSON or interactive HTML; 'reset' clears memory codes; 'delete' removes store file from disk.
content: Text document, knowledge snippet, or output file path depending on operation.
store_name: Unique identifier of the target memory store to manage (default: 'default').
project_root: Workspace directory where memory stores are persisted (default: current directory).
Behavior: Mutability: State-modifying and destructive; writes, consolidates, resets, or deletes local memory store JSON files on disk. Idempotency: Non-idempotent for write/reset operations; idempotent for 'list' and 'export' operations. Privacy & Network: 100% offline local JSON storage; zero external network synchronization. Performance & Resources: Executes in <50ms consuming <35MB RAM; thread-safe file handling. Auth: Zero authentication or cloud credentials required. Return Structure: Emits Markdown status report confirming memory consolidation, export file path, list of active memory stores, or deletion confirmation. Error Handling: Validates operation parameter and returns clear error guidance for unrecognized modes.
Usage Guidelines: When to use: Store new semantic knowledge, consolidate episodic memories, export knowledge graphs to JSON/HTML, list active memory stores, or clear/reset agent memories. When NOT to use: Do not use for querying existing knowledge triples or causal chains from memory (use 'query_memory_store' instead); do not use for pruning source code snippets or diff streams (use 'prune_code_snippet' instead).
Returns: Status report confirming memory consolidation, export file path, list of active memory stores, or confirmation of reset/deletion. |
| orchestrate_agent_swarmA | Coordinates autonomous multi-agent task execution, goal decomposition, Byzantine fault-tolerant (PBFT) consensus voting, and self-healing error recovery, distinguishing from 'manage_memory_store' and 'audit_code_quality' by dispatching autonomous multi-agent workflows rather than managing memory stores or auditing code quality. Parameters: goal: High-level mission objective, swarm proposal specification, or failing test traceback to heal.
orchestration_mode: Swarm coordination strategy: 'goal_execute' decomposes goals into phased agent workflows; 'swarm_consensus' runs Byzantine fault-tolerant voting with 3f+1 quorum; 'self_healing' diagnoses test failures and applies AST surgical patches.
agents: Comma-separated list of specialized agent roles participating in swarm execution (e.g. 'architect,coder,tester').
project_root: Target repository root directory for swarm task execution and test verification.
Behavior: Mutability: State-modifying; dispatches sub-tasks, validates proposals, and executes self-healing patches on disk files. Idempotency: Non-idempotent; execution outcomes adapt to dynamic agent consensus rounds and self-healing iterations. Privacy & Network: 100% offline local agent orchestration; zero unverified cloud relays or external data leaks. Performance & Resources: Completes consensus rounds in <100ms; thread-safe agent coordination. Auth: Zero authentication, external blockchain relays, or cloud credentials required. Return Structure: Emits structured orchestration summary with phased execution plan, agent task allocations, consensus voting tallies, or self-healing patch results. Error Handling: Quorum isolation automatically detects, flags, and neutralizes Byzantine faults and anomalous proposals.
Usage Guidelines: When to use: Execute high-level complex coding goals across multi-agent swarms, validate proposals via Byzantine consensus voting (3f+1 quorum), or diagnose and heal test failures. When NOT to use: Do not use for querying or managing long-term agent memory (use 'query_memory_store' and 'manage_memory_store' instead); do not use for auditing codebase quality before task execution (use 'audit_code_quality' instead).
Returns: Orchestration summary with phased execution plan, agent task allocations, consensus voting tallies, or self-healing patch results. |
| build_ast_snapshotA | Creates or reuses a persistent '.tzero/snapshot.json' AST index and returns cache status, distinguishing from 'build_project_context' which returns context without writing a snapshot and 'generate_architectural_passport' which inspects one file. Parameters: workspace_dir (str, optional, default='.'): Target repository root directory containing source code to index.
force_refresh (bool, optional, default=False): When True, invalidates existing snapshot and rebuilds fresh AST cache from disk.
Behavior: Mutability: Writes cached index to '.tzero/snapshot.json'; does not modify repository source code files. Idempotency: Deterministic index generation for identical repository state. Performance & Latency: Sub-8ms cache retrieval on hit; <600ms initial scan across 100+ files. Resources: Consumes <45MB RAM; thread-safe local file operations. Privacy: 100% offline local processing; zero external network transmission. Auth & Limits: Zero external credentials or API keys required; zero rate limits. Error Handling: Skips unparseable or binary files gracefully and continues indexing.
Usage Guidelines: When to use: Use when caching or fast-loading complete codebase AST symbols and token metrics in <8ms across multi-turn sessions or large workspaces (10,000+ files). When NOT to use: Do not use for real-time live symbol editing or single file pruning (use 'prune_code_snippet' instead); do not use for ad-hoc semantic keyword searching (use 'search_codebase' instead).
Returns: Formatted Markdown report detailing snapshot status, file count, load time, and token economics (-95%). |
| heal_hallucinated_codeA | Statically inspects candidate code against verified workspace AST symbol tables, detects phantom imports, misspelled identifiers, and hallucinated method calls, and rewrites the AST to the correct valid local identifier, distinguishing from 'verify_security_guard' and 'audit_code_quality' by actively applying AST node corrections rather than merely reporting violations or secret leaks. Parameters: code (str, required): The candidate Python source code string containing potential AI hallucinations or phantom methods.
workspace_dir (str, optional, default='.'): Target repository root directory containing ground-truth AST symbol definitions.
Behavior: Mutability: Non-destructive in-memory analysis and AST transformation; does not alter disk files. Idempotency: Returns identical corrected code and diffs for identical candidate code input. Performance & Latency: Completes AST inspection and healing in <100ms; consumes <35MB RAM. Privacy: 100% offline local AST parsing; zero external network transmission. Auth & Limits: Zero external credentials or API keys required; zero rate limits. Error Handling: Emits clean syntax error diagnostic if candidate code fails initial AST parsing.
Usage Guidelines: When to use: Use when repairing AI-generated code that contains hallucinated method names, phantom imports, or misspelled identifiers against real workspace AST symbol tables. When NOT to use: Do not use for general codebase static linting (use 'audit_code_quality' instead); do not use when merely checking if code is safe to execute without applying AST repairs (use 'verify_security_guard' instead).
Returns: Formatted Markdown report containing total repaired symbols, confidence percentages, unified AST diff, and healed code block. |
| prove_zero_hallucinationA | Runs a fixed 60-scenario hallucination detection benchmark, distinguishing from 'heal_hallucinated_code' for a single candidate snippet and 'audit_code_quality' for repository findings. Results apply only to the tested cases and do not prove absence of other hallucinations. Parameters: workspace_dir (str, optional, default='.'): Target repository root directory containing ground-truth AST symbol definitions.
export_docs (bool, optional, default=True): When True, updates docs/ZERO_HALLUCINATION_PROOF.md and docs/zero_hallucination_proof.json.
Behavior: Mutability: export_docs=True writes benchmark artifacts in docs/ relative to the server working directory; False avoids those writes. Idempotency: Report timestamps and measured latencies may differ between runs. 100% Offline: Operates entirely locally with zero external network access. Auth & Rate Limits: Zero authentication or cloud credentials required; completes in <100ms. Error Handling: Emits clean verification status and confusion matrix.
Usage Guidelines: When to use: Measure detection and false-positive rates on the bundled scenarios before or after changes. When NOT to use: Do not use for inspecting a single candidate snippet (use 'heal_hallucinated_code' instead); do not use for secret scans (use 'verify_security_guard' instead).
Returns: Markdown benchmark results with case counts, detection and false-positive rates, and latency. |
| transpile_model_bridgeA | Transpiles Python @dataclass and Pydantic data models into TypeScript interfaces, Rust structs, and Go structs deterministically via AST, distinguishing from 'prune_code_snippet' and 'generate_architecture_blueprint' by generating concrete cross-language type schemas rather than pruning code or diagramming topologies. Parameters: file_path (str, required): Path to the Python file containing @dataclass or Pydantic model definitions.
target_lang (str, optional, default='ts'): Target programming language: 'ts' (TypeScript), 'rust' (Rust with serde), 'go' (Golang), or 'all' (all languages).
Behavior: Mutability: Read-only static AST inspection; does not modify source files on disk. Idempotency: Produces identical type definitions for identical source model input. Performance & Latency: Completes model transpilation in <40ms; consumes <30MB RAM. Privacy: 100% offline local AST parsing; zero external network calls. Auth & Limits: Zero external credentials or API keys required; zero rate limits. Error Handling: Gracefully reports missing file or syntax error without crashing.
Usage Guidelines: When to use: Use when transpiling Python @dataclass and Pydantic models into TypeScript interfaces, Rust structs, or Go structs deterministically via AST. When NOT to use: Do not use for generic Python to JavaScript logic compilation (use specialized external compilers instead); do not use for high-level Mermaid architecture diagrams (use 'generate_architecture_blueprint' instead).
Returns: Formatted Markdown report containing transpiled type definitions in the requested target language. |
| diagnose_and_heal_systemA | Diagnoses and automatically repairs environment misconfigurations, virtualenv breakages, syntax errors, missing standard library imports, UTF-8 BOM artifacts, and orphaned bytecode across the workspace, distinguishing from 'heal_hallucinated_code' which strictly corrects phantom AST symbols in code snippets by instead performing holistic system-level health diagnostics and autonomous multi-category file healing. Parameters: workspace_dir (str, optional, default='.'): Target repository root directory containing source code and environment configurations to diagnose.
auto_repair (bool, optional, default=True): When True, applies surgical AST syntax patches, BOM sanitization, and cache cleanup to disk.
dry_run (bool, optional, default=False): When True, evaluates diagnostics and previews repair diffs without modifying files on disk.
Behavior: Mutability: Modifies files only when auto_repair=True and dry_run=False; otherwise strictly read-only. Idempotency: Multiple sequential executions converge to a 100% clean state without regressions. Performance & Latency: Scans and repairs 250+ files in <400ms using local standard library AST. Resources: Consumes <50MB RAM; local file system operations only. Privacy: 100% offline local processing; zero external network transmission. Auth & Limits: Zero external credentials or API keys required; zero rate limits. Error Handling: Continues diagnostic sweep across entire workspace if individual files contain unrecoverable binary corruption.
Usage Guidelines: When to use: Use when diagnosing overall workspace health, repairing Python syntax breakages (missing colons, Python 2 print), resolving missing standard imports, fixing virtualenv paths, or clearing stale cache bloat. When NOT to use: Do not use for repairing hallucinated LLM method names in isolated code snippets (use 'heal_hallucinated_code' instead); do not use for static cyclomatic complexity code smell audits (use 'audit_code_quality' instead).
Returns: Formatted Markdown report detailing initial health score, detected defects, surgical patch actions, and final post-healing health score. |
| generate_architectural_passportA | Returns a compact architectural passport for one Python file, distinguishing from 'build_project_context' for repository context, 'build_ast_snapshot' for a persisted index, and 'generate_architecture_blueprint' for repository diagrams. Parameters: Behavior: Mutability: Strictly read-only; does not modify source files or write to disk. Idempotency: Deterministic AST extraction producing identical passports for identical source files. Performance & Latency: Generates complete architectural passport in <20ms using local AST parsing. Resources: Consumes <30MB RAM; zero disk footprint. Privacy: 100% offline local processing; zero external network transmission. Auth & Limits: Zero external credentials or API keys required; zero rate limits. Error Handling: Returns clear error notification if target file is missing or unparseable.
Usage Guidelines: When to use: Use when grounding LLMs on a specific module or service before authoring code, generating prompt-ready architectural contracts, or evaluating module complexity and layer boundaries. When NOT to use: Do not use for entire repository multi-tier trees (use 'build_project_context' instead); do not use for graphical Mermaid visual diagrams (use 'generate_architecture_blueprint' instead).
Returns: Formatted Markdown architectural passport block ready for immediate LLM prompt ingestion. |
| execute_codebase_workflowA | Compatibility router for combined reports, distinguishing from 'build_project_context' and 'audit_code_quality' by combining analyses when action='auto'; for individual tasks use the dedicated tools directly. Parameters: action (optional, default='auto'): Workflow operation: 'auto' runs comprehensive all-in-one audit & context pipeline; 'context' builds AST context tree; 'audit' checks code quality & smells; 'security' runs Zero-Leak secret scan; 'blueprint' generates Mermaid architecture; 'dependencies' maps import topology; 'impact' evaluates blast radius of modified symbols; 'search' performs hybrid BM25 code search; 'prune' strips in-memory AST bodies; 'heal' runs AST self-healing; 'memory' manages episodic memory; 'swarm' coordinates multi-agent consensus.
target (optional, default='.'): Target repository root path, file path, git diff text buffer, or raw source code snippet to process.
query (optional, default=''): Free-text search term, focus symbol name, or goal prompt depending on selected action.
options (optional, default=''): Optional JSON string specifying extra configuration parameters (e.g. {"reduction_mode": "ultra", "max_tokens": 32000, "depth": 4}).
Behavior: Mutability: Depends on action and options. Security may install hooks; rules, memory, sync, healing, merge, and generated tests can modify files. Idempotency: Not guaranteed for state-changing operations. Privacy & Network: Most analysis is local, but blueprint with use_ai can contact a configured provider and transmit context. Performance & Resources: Runtime and memory depend on workspace size and selected operation. Auth: Zero authentication or cloud credentials required. Return Structure: Emits comprehensive executive Markdown report tailored to the requested action or full autonomous pipeline. Error Handling: Gracefully reports clean diagnostic notices for missing paths, unparseable files, or invalid JSON options without crashing.
Usage Guidelines: When to use: Use action='auto' for a combined report or retain this router for compatibility with existing clients. When NOT to use: Do not use when an isolated single-purpose operation is sufficient, such as generating an AST context tree (use 'build_project_context' instead), auditing code smells (use 'audit_code_quality' instead), scanning secrets (use 'verify_security_guard' instead), or pruning an in-memory snippet (use 'prune_code_snippet' instead).
Returns: Comprehensive Markdown report tailored to the requested action or full autonomous pipeline. |
| search_toolsA | Progressively discover and search registered T-Zero tools by keyword or domain category rather than loading all schemas at once, distinguishing from 'search_codebase' by discovering server tools and capabilities rather than searching repository source files. Parameters: query (optional, default=''): Optional keyword query (e.g., 'secret audit', 'pagerank', 'diff', 'merge').
category (optional, default='all'): Domain filter category: 'all', 'context', 'security', 'ast', 'memory', 'swarm', 'design'.
limit (optional, default=10): Maximum tool entries returned (integer 1-30; default: 10).
Behavior: Mutability & Speed: Read-only, idempotent catalog lookup executing in <5ms. Auth & Boundaries: Zero authentication, external credentials, or network access required.
Usage Guidelines: When to use: Discover specialized AST, Jarvis, or security tools by keyword; availability varies by tool mode. When NOT to use: Do not use when searching source files or symbols inside the workspace repository — use 'search_codebase' instead.
Returns: Structured dictionary with query, total_available, and ranked tools (name, category, summary). |