CodeTide is a fully local, privacy-preserving tool for parsing and understanding Python codebases using symbolic, structural analysis. No internet, no LLMs, no embeddings - just fast, explainable, and deterministic code intelligence.
Project description
CodeTide
CodeTide is a fully local, privacy-preserving tool for parsing and understanding Python codebases using symbolic, structural analysis. No internet, no LLMs, no embeddings - just fast, explainable, and deterministic code intelligence.
โ Key Features
- โ 100% local & private - all parsing and querying happens on your machine.
- ๐ฆ Structured parsing of codebases using Tree-sitter.
- ๐ง Retrieval of relevant code snippets by symbolic ID - not vector similarity.
- ๐งฑ Visualize the architecture and hierarchy of your project.
- โก Fast, cacheable parsing with smart update detection.
- ๐ Designed to work alongside tools like Copilot, GPT, and Claude - on your terms.
๐ VSCode Extension
CodeTide is available as a native Visual Studio Code extension, giving you direct access to structural code understanding inside your editor.
- Navigate code intelligently
- Retrieve context-aware snippets
- Send context directly to LLMs like Copilot or GPT
- Works seamlessly with any other extensions
๐ Install it now: CodeTide on VSCode Marketplace
๐ง Extension source code: CodeTide VSCode Extension on GitHub
๐ง CodeTide as an MCP Server
CodeTide now supports acting as an MCP Server, enabling seamless integration with AI agents and tools. This feature allows agents to dynamically interact with your codebase and retrieve context efficiently.
To enable CodeTide as an MCP server in your environment, add the following entry to your servers configuration file:
{
"mcpServers": {
"codetide": {
"command": "uvx",
"args": [
"--from",
"codetide",
"codetide-mcp-server"
],
"env": {
"CODETIDE_WORKSPACE": "./"
}
}
}
}
Why This Helps Agents
Agents working with codebases often need:
- Contextual Understanding: Retrieve declarations, imports, and references for any part of the code.
- Tool Integration: Use built-in tools to navigate and analyze code.
Available Tools
CodeTide provides the following tools for agents:
getContext
: Retrieve code context for identifiers (e.g., functions, classes).getRepoTree
: Explore the repository structure.
Example: Initializing an LLM with CodeTide
Hereโs a snippet from agent_tide.py
demonstrating how to initialize an LLM with CodeTide as an MCP server:
from aicore.llm import Llm, LlmConfig
from codetide.mcp import codeTideMCPServer
import os
def init_llm() -> Llm:
llm = Llm.from_config(
LlmConfig(
model="deepseek-chat",
provider="deepseek",
temperature=0,
api_key=os.getenv("DEEPSEEK-API-KEY")
)
)
llm.provider.mcp.add_server(name=codeTideMCPServer.name, parameters=codeTideMCPServer)
return llm
This setup allows the LLM to leverage CodeTideโs tools for codebase interactions.
CodeTide can now be used as an MCP Server! This allows seamless integration with AI tools and workflows. Below are the tools available: The available tools are:
- getContext: Retrieve code context for identifiers.
- getRepoTree: Generate a visual tree representation of the repository.
โ๏ธ Installation
๐ฆ From PyPI
pip install codetide --upgrade
๐ ๏ธ From Source
git clone https://github.com/BrunoV21/CodeTide.git
cd CodeTide
pip install -e .
๐ Example: Running CodeTide on Itself
Here's how to parse the CodeTide repository and extract a snippet from the Python parser:
from codetide import CodeTide
from codetide.core.common import writeFile
from dotenv import load_dotenv
import asyncio
import time
import os
async def main():
st = time.time()
tide = await CodeTide.from_path(os.getenv("CODETIDE_REPO_PATH"))
tide.serialize(include_cached_ids=True)
output = tide.get(["codetide.parsers.python_parser.PythonParser"], degree=1, as_string=True)
writeFile(output, "./storage/context.txt")
print(f"took {time.time()-st:.2f}s")
if __name__ == "__main__":
load_dotenv()
asyncio.run(main())
This example:
- Parses the codebase using Tree-sitter
- Serializes the result for fast reuse
- Retrieves a specific class with full local context
Here's how to deserialize a CodeTide repository and reuse it:
from codetide import CodeTide
from codetide.core.common import writeFile
from dotenv import load_dotenv
import asyncio
import time
import os
async def main():
st = time.time()
tide = CodeTide.deserialize(rootpath=os.getenv("CODETIDE_REPO_PATH"))
tide.codebase._build_cached_elements()
await tide.check_for_updates(include_cached_ids=True)
output = tide.get(["codetide.parsers.python_parser.PythonParser"], degree=2, as_string=True)
writeFile(output, "./storage/context.txt")
print(f"took {time.time()-st:.2f}s")
if __name__ == "__main__":
load_dotenv()
asyncio.run(main())
This example:
- Deserializes the previously serialized CodeTide
- Checks for updates to the codebase
- Retrieves a specific class with full local context (up to second degree connections)
Here's how to levarage CodeTide's tree view functionalites to get a broad picture of your project:
from codetide import CodeTide
from dotenv import load_dotenv
import time
import os
def main():
st = time.time()
tide = CodeTide.deserialize(rootpath=os.getenv("CODETIDE_REPO_PATH"))
modules_tree_view = tide.codebase.get_tree_view(include_modules=True)
print(modules_tree_view)
print(f"took {time.time()-st:.2f}s")
if __name__ == "__main__":
load_dotenv()
asyncio.run(main())
Output:
โโโ codetide
โ โโโ core
โ โ โโโ common.py
โ โ โ โโโ CONTEXT_INTRUCTION
โ โ โ โโโ TARGET_INSTRUCTION
โ โ โ โโโ readFile
โ โ โ โโโ wrap_content
โ โ โ โโโ wrap_package_dependencies
โ โ โ โโโ writeFile
โ โ โโโ defaults.py
โ โ โ โโโ DEFAULT_BATCH_SIZE
โ โ โ โโโ DEFAULT_CACHED_ELEMENTS_FILE
โ โ โ โโโ DEFAULT_CACHED_IDS_FILE
โ โ โ โโโ DEFAULT_ENCODING
โ โ โ โโโ DEFAULT_MAX_CONCURRENT_TASKS
โ โ โ โโโ DEFAULT_SERIALIZATION_PATH
โ โ โ โโโ INSTALLATION_DIR
โ โ โ โโโ LANGUAGE_EXTENSIONS
โ โ โโโ html.py
โ โ โ โโโ render_html_view
โ โ โโโ mermaid.py
โ โ โ โโโ _render_class_contents
โ โ โ โโโ _render_file_contents
โ โ โ โโโ _render_mermaid_node
โ โ โ โโโ _safe_mermaid_id
โ โ โ โโโ save_mermaid_to_html_file
โ โ โ โโโ to_mermaid_boxy_flowchart
โ โ โโโ models.py
โ โ โโโ BaseCodeElement
โ โ โ โโโ file_path
โ โ โ โโโ raw
โ โ โ โโโ stored_unique_id
โ โ โ โโโ apply_second_line_indent_to_first
โ โ โ โโโ file_path_without_suffix
โ โ โ โโโ unique_id
โ โ โ โโโ unique_id
โ โ โโโ ClassAttribute
โ โ โ โโโ class_id
โ โ โ โโโ visibility
โ โ โโโ ClassDefinition
โ โ โ โโโ attributes
โ โ โ โโโ bases
โ โ โ โโโ bases_references
โ โ โ โโโ methods
โ โ โ โโโ name
โ โ โ โโโ add_attribute
โ โ โ โโโ add_method
โ โ โ โโโ all_methods_ids
โ โ โ โโโ references
โ โ โโโ CodeBase
โ โ โ โโโ _cached_elements
โ โ โ โโโ root
โ โ โ โโโ _build_cached_elements
โ โ โ โโโ _build_tree_dict
โ โ โ โโโ _list_all_unique_ids_for_property
โ โ โ โโโ _render_class_contents
โ โ โ โโโ _render_file_contents
โ โ โ โโโ _render_tree_node
โ โ โ โโโ all_classes
โ โ โ โโโ all_functions
โ โ โ โโโ all_imports
โ โ โ โโโ all_variables
โ โ โ โโโ deserialize_cache_elements
โ โ โ โโโ get
โ โ โ โโโ get_import
โ โ โ โโโ get_tree_view
โ โ โ โโโ serialize_cache_elements
โ โ โ โโโ unique_ids
โ โ โโโ CodeContextStructure
โ โ โ โโโ _cached_elements
โ โ โ โโโ _unique_class_elements_ids
โ โ โ โโโ class_attributes
โ โ โ โโโ class_methods
โ โ โ โโโ classes
โ โ โ โโโ functions
โ โ โ โโโ imports
โ โ โ โโโ preloaded
โ โ โ โโโ requested_elements
โ โ โ โโโ variables
โ โ โ โโโ add_class
โ โ โ โโโ add_class_attribute
โ โ โ โโโ add_class_method
โ โ โ โโโ add_function
โ โ โ โโโ add_import
โ โ โ โโโ add_preloaded
โ โ โ โโโ add_variable
โ โ โ โโโ as_list_str
โ โ โ โโโ from_list_of_elements
โ โ โโโ CodeFileModel
โ โ โ โโโ classes
โ โ โ โโโ file_path
โ โ โ โโโ functions
โ โ โ โโโ imports
โ โ โ โโโ raw
โ โ โ โโโ variables
โ โ โ โโโ _list_all
โ โ โ โโโ add_class
โ โ โ โโโ add_function
โ โ โ โโโ add_import
โ โ โ โโโ add_variable
โ โ โ โโโ all_classes
โ โ โ โโโ all_functions
โ โ โ โโโ all_imports
โ โ โ โโโ all_variables
โ โ โ โโโ get
โ โ โ โโโ get_import
โ โ โ โโโ list_raw_contents
โ โ โโโ CodeReference
โ โ โ โโโ name
โ โ โ โโโ unique_id
โ โ โโโ FunctionDefinition
โ โ โ โโโ decorators
โ โ โ โโโ modifiers
โ โ โ โโโ name
โ โ โ โโโ references
โ โ โ โโโ signature
โ โ โโโ FunctionSignature
โ โ โ โโโ parameters
โ โ โ โโโ return_type
โ โ โโโ ImportStatement
โ โ โ โโโ alias
โ โ โ โโโ definition_id
โ โ โ โโโ import_type
โ โ โ โโโ name
โ โ โ โโโ raw
โ โ โ โโโ source
โ โ โ โโโ as_dependency
โ โ โโโ MethodDefinition
โ โ โ โโโ class_id
โ โ โโโ Parameter
โ โ โ โโโ default_value
โ โ โ โโโ name
โ โ โ โโโ type_hint
โ โ โ โโโ is_optional
โ โ โโโ PartialClasses
โ โ โ โโโ attributes
โ โ โ โโโ class_header
โ โ โ โโโ class_id
โ โ โ โโโ filepath
โ โ โ โโโ methods
โ โ โ โโโ raw
โ โ โโโ VariableDeclaration
โ โ โโโ modifiers
โ โ โโโ name
โ โ โโโ raw
โ โ โโโ references
โ โ โโโ type_hint
โ โ โโโ value
โ โโโ parsers
โ โ โโโ base_parser.py
โ โ โ โโโ BaseParser
โ โ โ โโโ extension
โ โ โ โโโ import_statement_template
โ โ โ โโโ language
โ โ โ โโโ parse_file
โ โ โ โโโ resolve_inter_files_dependencies
โ โ โ โโโ resolve_intra_file_dependencies
โ โ โ โโโ tree_parser
โ โ โโโ generic_parser.py
โ โ โ โโโ GenericParser
โ โ โ โโโ _filepath
โ โ โ โโโ extension
โ โ โ โโโ import_statement_template
โ โ โ โโโ language
โ โ โ โโโ parse_code
โ โ โ โโโ parse_file
โ โ โ โโโ resolve_inter_files_dependencies
โ โ โ โโโ resolve_intra_file_dependencies
โ โ โ โโโ tree_parser
โ โ โโโ python_parser.py
โ โ โโโ PythonParser
โ โ โโโ _filepath
โ โ โโโ _tree_parser
โ โ โโโ _default_unique_import_id
โ โ โโโ _find_elements_references
โ โ โโโ _find_references
โ โ โโโ _generate_unique_import_id
โ โ โโโ _get_content
โ โ โโโ _get_element_count
โ โ โโโ _process_aliased_import
โ โ โโโ _process_assignment
โ โ โโโ _process_block
โ โ โโโ _process_class_node
โ โ โโโ _process_decorated_definition
โ โ โโโ _process_expression_statement
โ โ โโโ _process_function_definition
โ โ โโโ _process_import_node
โ โ โโโ _process_node
โ โ โโโ _process_parameters
โ โ โโโ _process_type_parameter
โ โ โโโ _skip_init_paths
โ โ โโโ count_occurences_in_code
โ โ โโโ extension
โ โ โโโ filepath
โ โ โโโ filepath
โ โ โโโ import_statement_template
โ โ โโโ init_tree_parser
โ โ โโโ language
โ โ โโโ parse_code
โ โ โโโ parse_file
โ โ โโโ resolve_inter_files_dependencies
โ โ โโโ resolve_intra_file_dependencies
โ โ โโโ tree_parser
โ โ โโโ tree_parser
โ โโโ autocomplete.py
โ โโโ AutoComplete
โ โโโ __init__
โ โโโ get_fuzzy_suggestions
โ โโโ get_suggestions
โโโ examples
โ โโโ parse_codetide.py
โ โ โโโ main
โ โโโ parse_project.py
โ โโโ main
โโโ setup.py
โโโ here
โโโ long_description
โโโ requirements
โโโ requirements_visualization
๐ง Philosophy
CodeTide is about giving developers structure-aware tools that are fast, predictable, and private. Your code is parsed, navigated, and queried as a symbolic graph - not treated as a black box of tokens. Whether youโre building, refactoring, or feeding context into an LLM - you stay in control.
Like a tide, your codebase evolves - and CodeTide helps you move with it, intelligently.
โ What CodeTide Does Not Use
To be clear, CodeTide does not rely on:
- โ Large Language Models (LLMs)
- โ Embedding models or token similarity
- โ Vector databases or search indexes
- โ External APIs or cloud services
Instead, it uses:
- โ Tree-sitter for lightweight, fast, and accurate parsing
- โ Deterministic logic and symbolic references to navigate your codebase
๐บ๏ธ Roadmap
Hereโs whatโs next for CodeTide:
- ๐งฉ Support more languages already integrated with Tree-sitter
โ TypeScript is the top priority. Now available in Beta
- ๐งญ Handle relative imports in Python projects
โ Improve resolution for intra-package navigation.
๐ค Agents Module: AgentTide
CodeTide now includes an agents
module, featuring AgentTideโa precision-driven software engineering agent that connects directly to your codebase and executes your requests with full code context.
AgentTide leverages CodeTideโs symbolic code understanding to:
- Retrieve and reason about relevant code context for any request
- Generate atomic, high-precision patches using strict protocols
- Apply changes directly to your codebase, with robust validation
Where to Find It
- Source:
codetide/agents/tide/agent.py
What It Does
AgentTide acts as an autonomous agent that:
- Connects to your codebase using CodeTideโs parsing and context tools
- Interacts with users via a conversational interface
- Identifies relevant files, classes, and functions for any request
- Generates and applies diff-style patches, ensuring code quality and requirements fidelity
Example Usage
To use AgentTide, ensure you have the aicore
package installed (pip install codetide[agents]
), then instantiate and run the agent:
from codetide import CodeTide
from codetide.agents.tide.agent import AgentTide
from aicore.llm import Llm, LlmConfig
import os, asyncio
async def main():
tide = await CodeTide.from_path("/path/to/your/repo")
llm = Llm.from_config(
LlmConfig(
model="deepseek-chat",
provider="deepseek",
temperature=0,
api_key=os.getenv("DEEPSEEK-API-KEY")
)
)
agent = AgentTide(llm=llm, tide=tide)
await agent.run()
if __name__ == "__main__":
asyncio.run(main())
AgentTide will prompt you for requests, retrieve the relevant code context, and generate precise patches to fulfill your requirements.
Disclaimer: AgentTide is designed for focused, context-aware code editing, not for generating entire applications from vague ideas. While CodeTide as a platform can support larger workflows, the current version of AgentTide is optimized for making precise, well-scoped changes. For best results, provide one clear request at a time. AgentTide does not yet have access to your terminal or the ability to execute commands, but support for test-based validation is planned in future updates.
For more details, see the agents module source code.
๐ License
CodeTide is licensed under the Apache 2.0 License.
๐งโ๐ป Contributing
Interested in contributing to CodeTide? We welcome contributions of all kinds - especially new language parsers!
If you'd like to add support for a new language (e.g., Rust, Java, Go), see our CONTRIBUTING.md guide. You'll implement your parser by extending our BaseParser interface and providing robust test coverage. Reference implementations are available for Python and TypeScript in the tests/parsers directory.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file codetide-0.0.25.tar.gz
.
File metadata
- Download URL: codetide-0.0.25.tar.gz
- Upload date:
- Size: 69.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
c45b3a2e9f7179ff8f23e9104b958123e0349894a904313314067a58e3da1047
|
|
MD5 |
aff1e955b8baa1f9e4eeb2082e740666
|
|
BLAKE2b-256 |
afa3302bde49f4cc42fcf1b92b1f1058b0b1547857ea760521295d4b7ec282ca
|
Provenance
The following attestation bundles were made for codetide-0.0.25.tar.gz
:
Publisher:
python_package.yml
on BrunoV21/CodeTide
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
codetide-0.0.25.tar.gz
-
Subject digest:
c45b3a2e9f7179ff8f23e9104b958123e0349894a904313314067a58e3da1047
- Sigstore transparency entry: 299766683
- Sigstore integration time:
-
Permalink:
BrunoV21/CodeTide@39e28de44b7ccf1847e794778d71ba031da4f499
-
Branch / Tag:
refs/tags/v0.0.25
- Owner: https://github.com/BrunoV21
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
python_package.yml@39e28de44b7ccf1847e794778d71ba031da4f499
-
Trigger Event:
release
-
Statement type:
File details
Details for the file codetide-0.0.25-py3-none-any.whl
.
File metadata
- Download URL: codetide-0.0.25-py3-none-any.whl
- Upload date:
- Size: 71.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
f14ec25c7e26d4c05ef93519f038422d5d88e9c1df41f2f9094f72490e3c0001
|
|
MD5 |
60018a679724489f09751e2d8606150d
|
|
BLAKE2b-256 |
1d1d4ffde048d62b66db628ec735f904efa0c9b498bcbdaa9482f5cb5718cde7
|
Provenance
The following attestation bundles were made for codetide-0.0.25-py3-none-any.whl
:
Publisher:
python_package.yml
on BrunoV21/CodeTide
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
codetide-0.0.25-py3-none-any.whl
-
Subject digest:
f14ec25c7e26d4c05ef93519f038422d5d88e9c1df41f2f9094f72490e3c0001
- Sigstore transparency entry: 299766700
- Sigstore integration time:
-
Permalink:
BrunoV21/CodeTide@39e28de44b7ccf1847e794778d71ba031da4f499
-
Branch / Tag:
refs/tags/v0.0.25
- Owner: https://github.com/BrunoV21
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
python_package.yml@39e28de44b7ccf1847e794778d71ba031da4f499
-
Trigger Event:
release
-
Statement type: