| build_project_contextA | Scans the target repository file system and constructs a token-optimized AST context payload for LLM prompts across multiple hierarchy tiers (T-1 to T-4), distinguishing from 'prune_code_snippet' and 'search_codebase' by constructing multi-tier repository architecture trees rather than pruning individual in-memory snippets or executing keyword searches. Parameters: project_root (str, optional, default='.'): Target repository root path to scan.
context_type (str, optional, default='tree'): Context generation mode: 'tree' for hierarchical multi-tier AST tree, 'repo_map' for compact symbol index, 'skeleton' for focus-file implementation with 1st-degree caller/callee skeletons, 'zero_waste_prompt' for agent prompt prefix with pruned AST, 'incremental_diff' for git diff context.
focus_file (str, optional, default=''): Optional path to a focus file when context_type is 'skeleton' or 'incremental_diff'.
reduction_mode (str, optional, default='ultra'): AST reduction depth level ('ultra' for 80-95% compression with signatures and docstrings, 'balanced' for signatures + control structures, 'none' for verbatim source code).
max_tokens (int, optional, default=64000): Upper token budget threshold for returned context.
include_file_contents (bool, optional, default=True): If True, includes AST-reduced file bodies; if False, emits directory hierarchy only.
Behavior: Read-only: Scans workspace files and parses AST signatures without modifying disk state. Idempotent: Generates deterministic context representations for identical workspace revisions. 100% Offline: Operates entirely locally with zero telemetry, remote embedding APIs, or cloud billing. Auth & Rate Limits: Zero authentication or cloud credentials required; completes in <2s for 1,000 files. Error Handling: Returns clean Markdown warning notices if no analyzable files exist in the specified path.
Usage Guidelines: When to use: Ingest repository architecture, module indexes, focus file skeletons, or zero-waste prompts at the beginning of an agent coding session or major refactor (80-95% token savings). When NOT to use: Do not use for stripping implementation bodies from a single in-memory code string or diff patch (use 'prune_code_snippet' instead); do not use for querying specific code symbols or text without building a full context tree (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 token compression 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 complete lifecycle of architectural boundary definitions, tier rules (T-1 to T-4), and layer constraints configured in tzero.rules.json, distinguishing from 'enforce_architecture_rules' and 'generate_architecture_blueprint' by adding, updating, resetting, or deleting boundary definitions on disk rather than validating files or drawing diagrams. Parameters: action (str, optional, default='query'): Rule lifecycle action: 'query' to inspect active rules, 'update' to add or modify rules, 'delete' to remove a rule, 'reset' to restore defaults.
project_root (str, optional, default='.'): Target repository root where tzero.rules.json is located (default: current directory).
rule_name (str, optional, default=''): Name or identifier of the rule to update or delete when action is 'update' or 'delete'.
rule_definition (str, optional, default=''): JSON string or markdown specification of the rule to set when action is 'update'.
Behavior: State-Modifying / Destructive: Queries existing rules or updates/deletes layer boundary specifications on disk when action is 'update', 'delete', or 'reset'. Idempotent: Repeated queries or sets with identical values produce stable configurations. 100% Offline: Local JSON file management without external communication. Auth & Rate Limits: Zero authentication or cloud credentials required; executes in <20ms. Error Handling: Validates JSON syntax before writing; emits descriptive error messages on malformed rule definitions.
Usage Guidelines: When to use: Retrieve, inspect, add, update, reset, or delete architectural layer constraints (e.g. presentation -> domain -> persistence rules). When NOT to use: Do not use for actively validating codebase files against these rules (use 'enforce_architecture_rules' instead); do not use for generating visual Mermaid architectural topology diagrams (use 'generate_architecture_blueprint' instead).
Returns: JSON or Markdown status report detailing active or updated architectural rules. |
| enforce_architecture_rulesA | Enforces architectural boundary rules and layer isolation constraints defined in tzero.rules.json across the repository AST, distinguishing from 'manage_architecture_rules' and 'analyze_code_dependencies' by validating import graph compliance against defined architectural layers rather than editing rule definitions or tracing raw calls. Parameters: project_root (str, optional, default='.'): Root directory of the repository to validate (default: current directory).
strict_mode (bool, optional, default=True): When True, fails on any boundary infraction; when False, warns without raising errors.
Behavior: Read-only: Scans codebase imports and call paths; does not alter files. Idempotent: Deterministic violation reporting for identical codebase states. 100% Offline: Local import graph validation against configured boundaries. Auth & Rate Limits: Zero authentication or API keys required; completes in <500ms. Error Handling: Reports missing configuration and lists passed vs violated rules clearly.
Usage Guidelines: When to use: Run in CI/CD pipelines or before merging PRs to prevent architectural erosion (e.g. presentation layer importing database models or circular module dependencies). When NOT to use: Do not use for creating, viewing, or editing architectural boundary definitions (use 'manage_architecture_rules' instead); do not use for inspecting general dependencies between modules (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 imports, symbol call chains, graph centrality (PageRank), and unreferenced dead code across polyglot source files, distinguishing from 'analyze_change_impact' and 'enforce_architecture_rules' by performing global dependency structure and dead-code analysis rather than calculating change blast radius or verifying layer boundaries. Parameters: analysis_type (str, optional, default='dependencies'): Type of structural analysis: 'dependencies' for module import/export graph, 'call_chain' for deep caller/callee execution trace, 'pagerank' for architectural backbone centrality, 'dead_code' for unreferenced symbols.
project_root (str, optional, default='.'): Root directory of the repository to scan (default: current directory).
target_symbol (str, optional, default=''): Target class or function name when analysis_type is 'call_chain'.
file_path (str, optional, default=''): Optional path to a specific file to analyze.
Behavior: Read-only: Inspects source syntax trees without modifying or moving files. Idempotent: Deterministic dependency mapping for any scanned repository. 100% Offline: Local AST and regex parsers; zero external network requests. Auth & Rate Limits: Zero authentication or cloud credentials required; runs in <1s. Error Handling: Emits clean notices if the target symbol or file is not found in the AST index.
Usage Guidelines: When to use: Run before refactoring, moving, or removing a module to inspect inbound dependents, outbound imports, deep symbol call chains, or unreferenced functions. When NOT to use: Do not use for estimating the blast radius score of modifying a specific function or class (use 'analyze_change_impact' instead); do not use for validating whether imports violate architectural layer 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 functions, classes, and docstrings, 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 (str, required): Search term or natural language description of the code to locate.
project_root (str, optional, default='.'): Root directory of the repository to search (default: current directory).
top_k (int, optional, default=5): Maximum number of ranked results to return (default: 5).
Behavior: Read-only: Queries local code files without writing to disk or modifying indices. Idempotent: Deterministic ranked results for identical queries on the same codebase. 100% Offline: Executes entirely on CPU; no OpenAI/cloud embeddings, zero network egress. Auth & Rate Limits: Zero authentication or credentials required; sub-millisecond query latency. Error Handling: Returns empty match report with query suggestions if no relevant tokens are found.
Usage Guidelines: When to use: Locate relevant functions, classes, or code implementations across the repository using natural language or code identifier queries. When NOT to use: Do not use for querying persistent semantic knowledge graphs or agent memory triples (use 'query_memory_store' instead); do not use for generating full project 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, duplicate code block detection, and AI coding 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 (str, optional, default='.'): Root directory of the repository to audit (default: current directory).
check_type (str, optional, default='all'): Audit scope: 'all' for complete check, 'smells' for code complexity/smells, 'duplicity' for copy-paste blocks, 'hallucinations' for invalid imports/signatures.
file_path (str, optional, default=''): Optional path to a single file to audit.
Behavior: Read-only: Inspects source syntax trees; does not modify or delete files. Idempotent: Consistent diagnostic findings for the same code state. 100% Offline: Pure AST inspection without network calls. Auth & Rate Limits: Zero credentials or external linters required; completes in <500ms. Error Handling: Gracefully skips unparseable binary files and continues scanning source trees.
Usage Guidelines: When to use: Run before submitting PRs or executing refactors to catch long methods (>30 lines), excessive arguments (>5), missing docstrings, copy-pasted blocks (6+ lines), or hallucinated imports. When NOT to use: Do not use for scanning hardcoded secrets or installing git pre-commit security guards (use 'verify_security_guard' instead); do not use for analyzing module import 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 security 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 (str, optional, default='scan'): Security action: 'scan' to inspect files or content for secret leaks, 'install_pre_commit' to install the automated git zero-leak hook.
project_root (str, optional, default='.'): Target repository root to scan or install hook into (default: current directory).
content (str, optional, default=''): Optional raw text string to scan for secrets in memory without scanning disk files.
Behavior: Read-only when action is 'scan'; installs hook file when action is 'install_pre_commit'. Idempotent: Scans produce identical results; hook installation is idempotent. 100% Offline: Zero data transmission; all entropy and pattern checks execute locally. Auth & Rate Limits: Zero authentication or cloud credentials required; runs in <50ms. Error Handling: Reports exact line numbers and entropy score when secrets are detected.
Usage Guidelines: When to use: Ensure zero confidential credentials (OpenAI, Anthropic, Gemini, GitHub tokens, private keys) are exposed in code before committing or sharing context. When NOT to use: Do not use for general code quality, cyclomatic complexity, and duplicate code scans (use 'audit_code_quality' instead); do not use for enforcing layer boundary architecture rules (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 (str, required): Entity name, concept, or search query to look up in the memory store.
query_mode (str, optional, default='semantic'): Query strategy: 'semantic' for triple & relation lookup, 'causal_chain' for temporal cause-and-effect traces, 'minhash' for sub-microsecond entity similarity clusters.
project_root (str, optional, default='.'): Workspace root where memory store is located (default: current directory).
Behavior: Read-only: Queries persistent memory store without altering stored knowledge. Idempotent: Returns consistent knowledge relations for identical queries. 100% Offline: Local graph and MinHash index lookup without network traffic. Auth & Rate Limits: Zero authentication or cloud credentials required; query latency <10ms. Error Handling: Returns empty graph notice if the queried entity does not exist in the codebook.
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 modifying, compressing, 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 (str, optional, default='list'): Memory lifecycle operation: 'list' to show active memory stores, 'compress' to encode text into semantic triples, 'decompress' to decode memory code, 'consolidate' to merge memory, 'export' to dump graph, 'reset' to clear all memory, 'delete' to remove a specific store.
content (str, optional, default=''): Text document or knowledge content to compress or store when operation is 'compress'.
store_name (str, optional, default='default'): Identifier of the target memory store to manage.
project_root (str, optional, default='.'): Workspace root where memory stores are managed (default: current directory).
Behavior: State-Modifying / Destructive: Consolidates or updates local memory state; 'reset' and 'delete' operations remove stored memory data from disk. Non-idempotent for state modifications; idempotent for 'list' and 'export'. 100% Offline: Fully local storage management without external synchronization. Auth & Rate Limits: Zero authentication or credentials required; completes in <50ms. Error Handling: Validates operation parameter and returns clear error 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 (str, required): High-level goal description, swarm proposal, or failing test traceback to heal.
orchestration_mode (str, optional, default='goal_execute'): Orchestration mode: 'goal_execute' for autonomous goal planning and execution, 'swarm_consensus' for Byzantine fault-tolerant voting, 'self_healing' for AST error diagnosis and automated patching.
agents (str, optional, default=''): Comma-separated list of agent roles participating in swarm execution (e.g. 'architect,coder,tester').
project_root (str, optional, default='.'): Workspace root for swarm execution (default: current directory).
Behavior: State execution: Dispatches sub-tasks, coordinates consensus rounds, and executes self-healing patches. Non-idempotent: Execution results reflect dynamic agent responses and patch attempts. 100% Offline: Executes deterministic local multi-agent workflows without unverified cloud relays. Auth & Rate Limits: Zero credentials or external blockchain relays required; completes in <100ms. Error Handling: Quorum isolation automatically detects and neutralizes Byzantine faults.
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. |
| execute_codebase_workflowA | Autonomous all-in-one T-Zero master tool that executes any codebase workflow in a single command, distinguishing from individual specialized tools by autonomously orchestrating multi-step analysis, context generation, security scans, dependency mapping, and self-healing in an integrated pipeline. Parameters: action (str, optional, default='auto'): Workflow operation: 'auto' (runs comprehensive all-in-one audit & context pipeline), 'context' (builds AST context tree), 'audit' (code quality & smells), 'security' (Zero-Leak secret scan), 'blueprint' (Mermaid system architecture), 'dependencies' (import & module topology), 'impact' (blast radius of modified symbols), 'search' (hybrid BM25 semantic code search), 'prune' (in-memory AST snippet pruning), 'heal' (AST self-healing diagnosis & patching), 'memory' (query/manage memory store), 'swarm' (multi-agent consensus & task dispatch), or 'design' (UI/UX design blueprint).
target (str, optional, default='.'): Target repository root path, file path, diff string, or raw code snippet.
query (str, optional, default=''): Search term, focus symbol name, or goal prompt depending on action.
options (str, optional, default=''): Optional JSON string specifying extra configuration parameters (e.g. reduction_mode, max_tokens, depth).
Behavior: Orchestrated execution: When action='auto', performs a complete end-to-end audit (security, architecture, token savings, dependencies) and delivers a unified executive summary. Deterministic: Dispatches to specialized underlying T-Zero engines. 100% Offline: Executes entirely on local AST without sending code to unverified cloud APIs. Auth & Rate Limits: Zero credentials required; completes in <500ms. Error Handling: Gracefully falls back and reports clean diagnostic messages for missing paths or invalid JSON options.
Usage Guidelines: When to use: Use whenever you want an instant complete overview of a codebase, or want to perform any T-Zero operation through a single unified entrypoint without choosing between individual tools. When NOT to use: Do not use if you specifically need an isolated low-level API call without any contextual wrapper.
Returns: Comprehensive Markdown report tailored to the requested action or full autonomous pipeline. |