Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
b7aa3fb
chore(ui): This commit notes stream wrapper TODOs
BrunoV21 Oct 2, 2025
21d9005
feat(ui): This commit adds ticket and reasoning demos
BrunoV21 Oct 2, 2025
dbb323c
refactor(ui): This commit refactors reasoning explorer layout
BrunoV21 Oct 2, 2025
9b8b128
feat(ui): This commit adds loader icon
BrunoV21 Oct 2, 2025
c83da84
chore(ui,utils): This commit outlines reasoning todo updates
BrunoV21 Oct 2, 2025
a913a92
refactor: This commit streamlines explorer ui/ids
BrunoV21 Oct 7, 2025
248222c
refactor(ui): This commit streamlines reasoning UI
BrunoV21 Oct 7, 2025
172cd6d
feat(ui): This commit adds full-mode field-aware streaming
BrunoV21 Oct 7, 2025
4264ca2
test(stream-processor): This commit adds stream processor tests
BrunoV21 Oct 7, 2025
86d9b21
docs(ui): This commit adds reasoning templates
BrunoV21 Oct 7, 2025
d3a223f
feat(ui): This commit adds custom element field streaming
BrunoV21 Oct 7, 2025
dc4c65d
test(stream): This commit adds custom element streaming tests
BrunoV21 Oct 7, 2025
271d95a
feat(ui): This commit adds finished reasoning summary title
BrunoV21 Oct 8, 2025
3c6fed2
refactor(prompts): extend tide agent prompts with candidate gathering…
BrunoV21 Oct 8, 2025
48e51ca
refactor(agent): implement two-phase identifier resolution and improv…
BrunoV21 Oct 8, 2025
31c8d9e
refactor(ui): update agent_loop stream handling and reasoning UI inte…
BrunoV21 Oct 8, 2025
8a53ede
refactor(ui): enhance CustomElementStep prop updates with smart mergi…
BrunoV21 Oct 8, 2025
39640ad
fix(ui): correct reasoning element initialization and message sending…
BrunoV21 Oct 8, 2025
50bc1be
feat(agent,ui): add reasoning start/finish markers and handle in UI s…
BrunoV21 Oct 9, 2025
4bdb3ee
fix(ui): handle control chunk cases properly in agent loop to avoid p…
BrunoV21 Oct 9, 2025
af395e0
fix(ui): await message send and optimize CustomElementStep prop updates
BrunoV21 Oct 9, 2025
bc26e61
refactor(ui): enhance field extraction with schema support and update…
BrunoV21 Oct 9, 2025
c7db8fb
fix(ui): update field extractor regex patterns in app
BrunoV21 Oct 11, 2025
cc4be39
chore(ui): add debug prints and update reasoning element state
BrunoV21 Oct 11, 2025
e710746
refactor(ui): enhance stream processing with custom element support a…
BrunoV21 Oct 12, 2025
873ce0f
refactor(tide): improve history expansion logic and clean debug print…
BrunoV21 Oct 12, 2025
eb694a5
refactor(ui): improve agent loop message handling and regex parsing i…
BrunoV21 Oct 12, 2025
ad3aad6
feat(ui): enhance ReasoningExplorer with animated wave, refined styli…
BrunoV21 Oct 12, 2025
d79752f
feat(ui): add loading wave animation and improve reasoning explorer l…
BrunoV21 Oct 12, 2025
bfa26b6
fix(agent): add missing reasoning finished log call in tide agent
BrunoV21 Oct 12, 2025
a01c395
refactor(prompts): enhance candidate deduplication and reasoning clar…
BrunoV21 Oct 12, 2025
b3605d4
feat(ui): enhance ReasoningExplorer with dynamic loading states, thin…
BrunoV21 Oct 12, 2025
ee3f71b
feat(ui): enhance ReasoningExplorer with toggleable identifiers and i…
BrunoV21 Oct 12, 2025
ddb2fd3
refactor(tide): update prompt identifier rules and fix prompt formatt…
BrunoV21 Oct 12, 2025
4189585
refactor(ui): update ReasoningExplorer to use collapsible summary pre…
BrunoV21 Oct 13, 2025
7583299
style(ui): improve text styling and truncation in ReasoningExplorer c…
BrunoV21 Oct 13, 2025
f62d434
refactor(ui): simplify ReasoningExplorer loading state and preview re…
BrunoV21 Oct 13, 2025
e1328fe
refactor(ui): improve ReasoningExplorer layout and loading animation …
BrunoV21 Oct 13, 2025
650fa8d
feat(ui): update ReasoningExplorer to show 'Finished' status when done
BrunoV21 Oct 13, 2025
67a16a6
style(ui): improve spacing and border radius in ReasoningExplorer ide…
BrunoV21 Oct 13, 2025
e0f706d
refactor(ui): improve ReasoningExplorer component with better state h…
BrunoV21 Oct 13, 2025
258c280
fix(agent): add missing reasoning finished log and fix spacing in age…
BrunoV21 Oct 13, 2025
a5fbdd5
refactor(ui): simplify ReasoningExplorer component and improve readab…
BrunoV21 Oct 14, 2025
106be70
refactor(ui): simplify ReasoningExplorer component and improve stylin…
BrunoV21 Oct 14, 2025
236f08f
refactor(ui): update ReasoningExplorer step layout and timeline styling
BrunoV21 Oct 14, 2025
5f4b28e
fix(ui): correct reasoning steps timeline connector rendering and height
BrunoV21 Oct 14, 2025
b1e2b26
feat(ui): enhance ReasoningExplorer step icon with glow effect and im…
BrunoV21 Oct 14, 2025
fc124e0
refactor(ui): enhance ReasoningExplorer layout, styling, and badge pr…
BrunoV21 Oct 14, 2025
f5c2a6a
style(ui): update ReasoningExplorer context and modification badges s…
BrunoV21 Oct 14, 2025
24fed2f
style(ui): fix spacing and margin inconsistencies in ReasoningExplore…
BrunoV21 Oct 14, 2025
1f3c731
feat(ui): add collapsible reasoning steps card with expanded view and…
BrunoV21 Oct 14, 2025
c47ef88
fix(ui): correct loading state logic and adjust reasoning step connec…
BrunoV21 Oct 14, 2025
2885aa3
fix(ui): update ReasoningExplorer header to show 'Finished' when done
BrunoV21 Oct 14, 2025
9527212
refactor(prompts): enhance candidate classification and filtering log…
BrunoV21 Oct 14, 2025
06d2755
feat(ui): enhance ReasoningExplorer loading states with varied animat…
BrunoV21 Oct 15, 2025
c53e9a7
refactor(core): enhance _build_tree_dict with slim mode and improved …
BrunoV21 Oct 15, 2025
b0821ee
refactor(agent): improve reasoning parsing and candidate extraction i…
BrunoV21 Oct 15, 2025
2876941
refactor(prompts): simplify and clarify final selection prompt format…
BrunoV21 Oct 15, 2025
273b95d
refactor(prompts): update candidate gathering prompt for clarity and …
BrunoV21 Oct 15, 2025
513b4b2
refactor(agent): improve context labeling and prompt formatting in ti…
BrunoV21 Oct 15, 2025
8daf3b8
style(ui): add top margin to modification identifiers label in Reason…
BrunoV21 Oct 16, 2025
d1e0e9f
refactor(ui): clear example summary and comment out chat update in ap…
BrunoV21 Oct 16, 2025
a0aeb9d
refactor(agent): add placeholders for operation mode and system promp…
BrunoV21 Oct 16, 2025
7527efb
fix(agent,ui): move update checks and message send under context retr…
BrunoV21 Oct 18, 2025
a1fd59b
fix(prompts): remove date references from patch and steps system prompts
BrunoV21 Oct 18, 2025
d99b312
refactor(prompts): remove unused history checks and operation mode li…
BrunoV21 Oct 18, 2025
ea57506
feat(agent): add operation mode extraction and dynamic history expans…
BrunoV21 Oct 18, 2025
5ca7d74
refactor(agent): update get_identifiers_two_phase to accept expanded_…
BrunoV21 Oct 18, 2025
18a9c80
refactor(agent): disable streaming in prompt calls for operation mode…
BrunoV21 Oct 19, 2025
00efeec
fix(agent): correct sufficient_context extraction and refine direct_m…
BrunoV21 Oct 19, 2025
70ccac8
refactor(prompts): update operation mode extraction prompt with stric…
BrunoV21 Oct 20, 2025
1d32afc
refactor(prompts): update history relevance prompt with stricter form…
BrunoV21 Oct 20, 2025
2e761ee
refactor(tide): centralize special tokens and update chunk logger fil…
BrunoV21 Oct 20, 2025
168aca5
feat(prompts): add prefix summary prompt for enhanced context integra…
BrunoV21 Oct 20, 2025
77ef187
fix(streaming): correct token filtering logic in chunk_logger
BrunoV21 Oct 20, 2025
d9e1806
refactor(agent): enhance code context handling with prefilled summary…
BrunoV21 Oct 20, 2025
d8f2c4e
fix(agent): correct variable assignment and context handling in agent.py
BrunoV21 Oct 20, 2025
8becc81
refactor(prompts): update candidate gathering and final selection pro…
BrunoV21 Oct 21, 2025
bdcb931
refactor(prompts): update operation mode extraction prompt for clarit…
BrunoV21 Oct 21, 2025
d58dd1c
style(prompts): improve formatting and clarify insertion context rules
BrunoV21 Oct 25, 2025
6b500ee
refactor(prompts): update mandate sections and reasoning format in ti…
BrunoV21 Oct 25, 2025
fe5cd6f
refactor(prompts): update operation mode extraction prompt for clarit…
BrunoV21 Oct 25, 2025
5ad5f54
refactor(prompts): update candidate identification rules and state fo…
BrunoV21 Oct 25, 2025
070dc24
refactor(prompts): clarify selection logic and classification in iden…
BrunoV21 Oct 25, 2025
f2c333e
refactor(prompts): enhance context sufficiency output with conditiona…
BrunoV21 Oct 25, 2025
39eeaf4
refactor(prompts): expand context sufficiency and search query criteria
BrunoV21 Oct 26, 2025
8c0768e
refactor(prompts): update candidate gathering prompts for clarity and…
BrunoV21 Oct 26, 2025
4cb4ada
feat(agent): integrate smart code search for identifier gathering and…
BrunoV21 Oct 26, 2025
3284cfb
refactor(prompts): update candidate identifier search query instructions
BrunoV21 Oct 26, 2025
a9c7fd9
refactor(agent): optimize codebase tree building and include repo tre…
BrunoV21 Oct 26, 2025
418e96b
feat(prompts): add repo tree context to identifier search prompt
BrunoV21 Oct 26, 2025
fcc7654
refactor(prompts): enhance candidate identification logic and reasoni…
BrunoV21 Oct 26, 2025
596ab3c
fix(codetide): correct file path handling for new files in codebase
BrunoV21 Oct 26, 2025
ba0f604
refactor(prompts): clarify classification criteria and update summary…
BrunoV21 Oct 26, 2025
e62ac9d
refactor(agent): improve multi-iteration candidate gathering and pars…
BrunoV21 Oct 26, 2025
637d48b
refactor(prompts): enforce strict structural compliance and update ca…
BrunoV21 Oct 26, 2025
298900d
refactor(tide): separate operation mode system and prefix prompts and…
BrunoV21 Oct 26, 2025
96a82ee
chore(prompts): enforce strict output format and strengthen identifie…
BrunoV21 Oct 26, 2025
73bc860
refactor(prompts): clarify search query output to use concise keyword…
BrunoV21 Oct 26, 2025
70e8337
chore(prompts): update strict output format enforcement and context r…
BrunoV21 Oct 26, 2025
bd2d922
refactor(ui): add reasoning thinking time tracking and cleanup Reason…
BrunoV21 Oct 26, 2025
afb93b7
refactor(agent): improve context handling and identifier matching in …
BrunoV21 Oct 26, 2025
0ca8008
fix(agent): improve identifier sufficiency check in agent logic
BrunoV21 Oct 26, 2025
a45da4a
style(prompts): update reminder to enforce output structure and ident…
BrunoV21 Oct 26, 2025
fcc16b8
refactor(prompts): update prompt summary guidelines for clarity and p…
BrunoV21 Oct 26, 2025
89821d1
refactor(agent): improve candidate identifier extraction logic in tid…
BrunoV21 Oct 26, 2025
6fe6635
refactor(core): remove emoji icons from codebase tree display and use…
BrunoV21 Oct 27, 2025
455c3ff
refactor(ui): update history management to conditionally sync with ag…
BrunoV21 Oct 27, 2025
331280a
refactor(ui): update llm validation logic and enhance history trackin…
BrunoV21 Oct 27, 2025
ef91647
fix(agent): resolve conditional checks, initialize history count, and…
BrunoV21 Oct 27, 2025
766e025
feat(autocomplete): add async word extraction and lazy sorting optimi…
BrunoV21 Oct 27, 2025
461b380
refactor(agents/tide): optimize identifier resolution with direct mat…
BrunoV21 Oct 27, 2025
0843a4c
refactor(agent): remove unused AutoComplete instantiation in search q…
BrunoV21 Oct 27, 2025
7b377af
fix(ui): prevent expansion interaction when reasoning steps are empty…
BrunoV21 Oct 27, 2025
93a13a4
style(agent,prompts): fix indentation and refactor system prompt desc…
BrunoV21 Oct 28, 2025
ac3fd08
refactor(agent): restructure context handling in agent loop to separa…
BrunoV21 Oct 28, 2025
e131c71
feat(autocomplete): add timeout parameter to async word extraction
BrunoV21 Oct 29, 2025
8a10231
refactor(core): fix indentation in codebase tree building logic
BrunoV21 Nov 6, 2025
1874aff
fix(agent): enhance condition for context sufficiency check in reason…
BrunoV21 Nov 8, 2025
dd0f87b
feat(codetide): add filenames_mapped property for filename-to-path ma…
BrunoV21 Nov 9, 2025
ba2b504
feat(autocomplete): add mapped words support for filename resolution
BrunoV21 Nov 9, 2025
58417ff
fix(patch_code): comment out isolated change normalization logic
BrunoV21 Nov 9, 2025
379d725
feat(ui): add hidden prop and update default expanded state in Reason…
BrunoV21 Nov 14, 2025
f21bdac
refactor(ui): remove unused example data and ticket functionality fro…
BrunoV21 Nov 14, 2025
ad39b5d
refactor(agents/tide): restructure agent architecture with modular co…
BrunoV21 Nov 14, 2025
9c992b4
fix(ui): correct typo in code identifier variable name across UI modules
BrunoV21 Nov 14, 2025
4900224
feat(tide): add topic detection and enhance operation mode extraction…
BrunoV21 Nov 14, 2025
d7156a1
prompt(tide): refactor calmness system prompt to improve CLI response…
BrunoV21 Nov 14, 2025
cc24f87
prompt(tide): remove file names and code snippets guidance from respo…
BrunoV21 Nov 15, 2025
78e0da2
docs: fix typographic apostrophes in README
BrunoV21 Nov 15, 2025
3fe7452
refactor(agent,prompts): update context handling and summary prompt
BrunoV21 Nov 15, 2025
ac663cc
refactor(agent): comment out early exit in identifier resolver
BrunoV21 Nov 15, 2025
a5e4c40
docs(readme): update agenttide usage instructions and descriptions
BrunoV21 Nov 15, 2025
1db713a
refactor(agent): add default values to field extraction
BrunoV21 Nov 16, 2025
95a30e7
feat(codetide): add module identifier handling and precheck functiona…
BrunoV21 Nov 23, 2025
4506911
feat(codetide): add relative_directories property and update cached_ids
BrunoV21 Nov 23, 2025
1ba2354
build(deps): update dependencies for agents and agents-ui
BrunoV21 Dec 9, 2025
2088263
fix(codetide): normalize path handling to preserve trailing slashes
BrunoV21 Dec 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 29 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ uvx --from codetide codetide-cli --help
```
## AgentTide

AgentTide consists of a demo, showing how CodeTide can integrate with LLMs and augment code generation and condebase related workflows. If you ask Tide to describe himself, he will say something like this: I'm the next-generation, precision-driven software engineering agent built on top of CodeTide. You can use it via the command-line interface (CLI) or a beautiful interactive UI.
AgentTide is a next-generation, precision-driven software engineering agent built on top of CodeTide. It is ready to help you dig deep into your codebase, automate code changes, and provide intelligent, context-aware assistance. You can use it via the command-line interface (CLI) or a beautiful interactive UI.

> **Demo available:** Try AgentTide live on Hugging Face Spaces: [https://mclovinittt-agenttidedemo.hf.space/](https://mclovinittt-agenttidedemo.hf.space/)
> **Try AgentTide live:** [https://mclovinittt-agenttidedemo.hf.space/](https://mclovinittt-agenttidedemo.hf.space/)

---

Expand All @@ -57,46 +57,44 @@ AgentTide consists of a demo, showing how CodeTide can integrate with LLMs and a

**AgentTide CLI**

To use the AgentTide conversational CLI, you must install the `[agents]` extra and launch via:
To use the AgentTide conversational CLI, install the `[agents]` extra and launch via:

```sh
uvx --from codetide[agents] agent-tide
```

This will start an interactive terminal session with AgentTide.

You can also pass the `--project_path` argument to start AgentTide on a specific path:
This starts an interactive terminal session with AgentTide. You can specify a project path:

```sh
uvx --from codetide[agents] agent-tide --project_path /path/to/your/project
```

If you do not provide the `--project_path` argument, AgentTide will start in the current directory by default.
If `--project_path` is not provided, AgentTide starts in the current directory.

**AgentTide UI**

To use the AgentTide web UI, you must install the `[agents-ui]` extra and launch via:
To use the AgentTide web UI, install the `[agents-ui]` extra and launch:

```sh
uvx --from codetide[agents-ui] agent-tide-ui
```

This will start a web server for the AgentTide UI. Follow the on-screen instructions to interact with the agent in your browser at [http://localhost:9753](http://localhost:9753) (or the port you specified)
This starts a web server for the AgentTide UI. Interact with the agent in your browser at [http://localhost:9753](http://localhost:9753) (or your specified port).

### Why Try AgentTide? ([Full Guide & Tips Here](codetide/agents/tide/ui/chainlit.md))
### Why Use AgentTide? ([Full Guide & Tips Here](codetide/agents/tide/ui/chainlit.md))

**Local-First & Private:** All code analysis and patching is performed locally. Your code never leaves your machine.
- **Local-First & Private:** All code analysis and patching is performed locally. Your code never leaves your machine.
- **Transparent & Stepwise:** See every plan and patch before it's applied. Edit, reorder, or approve stepsβ€”you're always in control.
- **Context-Aware:** AgentTide loads only the relevant code identifiers and dependencies for your request, making it fast and precise.
- **Human-in-the-Loop:** After each step, review the patch, provide feedback, or continueβ€”no black-box agent behavior.
- **Patch-Based Editing:** All changes are atomic diffs, not full file rewrites, for maximum clarity and efficiency.

**Usage Tips:**
- If you know the exact code context, specify identifiers directly in your request (e.g., `module.submodule.file_withoutextension.object`).
- You can use the `plan` command to generate a step-by-step implementation plan for your request, review and edit the plan, and then proceed step-by-step.
- The `commit` command allows you to review and finalize changes before they are applied.
- Use the `plan` command to generate a step-by-step implementation plan for your request, review and edit the plan, and then proceed step-by-step.
- Use the `commit` command to review and finalize changes before they are applied.

See the [chainlit.md](codetide/agents/tide/ui/chainlit.md) for full details and advanced workflows, including the latest specifications for these commands!
See [chainlit.md](codetide/agents/tide/ui/chainlit.md) for full details and advanced workflows, including the latest specifications for these commands!

---

Expand Down Expand Up @@ -156,7 +154,7 @@ CodeTide provides the following tools for agents:
2. **`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:
Here's a snippet from `agent_tide.py` demonstrating how to initialize an LLM with CodeTide as an MCP server:

```python
from aicore.llm import Llm, LlmConfig
Expand All @@ -176,7 +174,7 @@ def init_llm() -> Llm:
return llm
```

This setup allows the LLM to leverage CodeTide’s tools for codebase interactions.
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:
Expand Down Expand Up @@ -517,7 +515,7 @@ if __name__ == "__main__":

## 🧠 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**.
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.

Expand All @@ -539,7 +537,7 @@ Instead, it uses:

## πŸ—ΊοΈ Roadmap

Here’s what’s next for CodeTide:
Here's what's next for CodeTide:

- 🧩 **Support more languages** already integrated with [Tree-sitter](https://tree-sitter.github.io/tree-sitter/)
β†’ **TypeScript** is the top priority. **Now available in Beta**
Expand All @@ -554,11 +552,11 @@ Here’s what’s next for CodeTide:

## πŸ€– Agents Module: AgentTide

> **Demo available:** Try AgentTide live on Hugging Face Spaces: [https://mclovinittt-agenttidedemo.hf.space/](https://mclovinittt-agenttidedemo.hf.space/)
> **Try AgentTide live:** [https://mclovinittt-agenttidedemo.hf.space/](https://mclovinittt-agenttidedemo.hf.space/)

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.
CodeTide now includes an `agents` module, featuring **AgentTide**β€”a production-ready, 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:
**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
Expand All @@ -567,14 +565,15 @@ CodeTide now includes an `agents` module, featuring **AgentTide**β€”a precision-
- Source: [`codetide/agents/tide/agent.py`](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
AgentTide is an autonomous, precision-driven software engineering agent that:
- Connects to your codebase using CodeTide's parsing and context tools
- Interacts with users via a conversational interface (CLI or UI)
- Identifies relevant files, classes, and functions for any request using advanced identifier resolution and code search
- Generates and applies atomic, diff-style patches using a strict protocol, ensuring code quality and requirements fidelity
- Supports stepwise planning, patch review, and human-in-the-loop approval for every change

### Example Usage
To use AgentTide, ensure you have the `aicore` package installed (`pip install codetide[agents]`), then instantiate and run the agent:
To use AgentTide programmatically, ensure you have the `aicore` package installed (`pip install codetide[agents]`), then instantiate and run the agent:

```python
from codetide import CodeTide
Expand All @@ -599,10 +598,10 @@ 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.
AgentTide will prompt you for requests, retrieve the relevant code context, and generate precise, atomic patches to fulfill your requirements. All changes are patch-based and require explicit approval before being applied.

**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.
**Note:**
AgentTide is designed for focused, context-aware code editing, not for generating entire applications from vague ideas. For best results, provide one clear request at a time. AgentTide does not execute code or shell commands, but support for test-based validation is planned in future updates.

For more details, see the [agents module source code](codetide/agents/tide/agent.py).

Expand Down
123 changes: 117 additions & 6 deletions codetide/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from pydantic import BaseModel, ConfigDict, Field, field_validator
from typing import Optional, List, Tuple, Union, Dict
from datetime import datetime, timezone
from collections import defaultdict
from pathlib import Path
import traceback
import asyncio
Expand Down Expand Up @@ -97,10 +98,27 @@ def relative_filepaths(self)->List[str]:
return [
str(filepath.relative_to(self.rootpath)).replace("\\", "/") for filepath in self.files
]

@property
def relative_directories(self) -> List[str]:
dirs = set()
for filepath in self.files:
p = filepath.resolve().parent
while p != self.rootpath:
dirs.add(p.relative_to(self.rootpath).as_posix())
p = p.parent
return sorted(dirs)

@property
def filenames_mapped(self)->Dict[str, str]:
return {
filepath.name: str(filepath.relative_to(self.rootpath)).replace("\\", "/")
for filepath in self.files
}

@property
def cached_ids(self)->List[str]:
return self.codebase.non_import_unique_ids+self.relative_filepaths
return self.codebase.non_import_unique_ids + self.relative_filepaths + self.relative_directories

@property
def repo(self)->Optional[pygit2.Repository]:
Expand Down Expand Up @@ -412,6 +430,7 @@ def _get_changed_files(self) -> Tuple[List[Path], bool]:
"""
file_deletion_detected = False
files = self._find_code_files() # Dict[Path, datetime]
print("found code files")

changed_files = []

Expand Down Expand Up @@ -528,6 +547,97 @@ def _is_file_content_valid(filepath :Path)->bool:

return True

@staticmethod
def _is_subdirectory(identifier: str) -> bool:
"""
Check if an identifier represents a module/subdirectory.

Args:
identifier: A string or Path object to check

Returns:
True if the identifier ends with '/' (indicating a module), False otherwise
"""
if isinstance(identifier, Path):
return False
elif identifier.endswith("/"):
return True
else:
return False

def get_module_identifiers(self, module_ids: List[str]) -> Dict[str, List[str]]:
"""
Get all file identifiers that belong to specified modules.

Args:
module_ids: List of module identifier strings (directories)

Returns:
Dictionary mapping module names to lists of relative file paths within each module
"""
module_paths = {
self.rootpath / module_id
for module_id in module_ids
}
modules_identifiers = defaultdict(list)
for filepath in self.files:
for module_path in module_paths:
if filepath.is_relative_to(module_path):
modules_identifiers[module_path.name].append(
str(filepath.relative_to(self.rootpath))
)
break

# Log the results
logger.info(f"Found {len(modules_identifiers)} modules")
for module_name, identifiers in modules_identifiers.items():
logger.info(f"Module '{module_name}' contains {len(identifiers)} identifiers")

return modules_identifiers

def inject_identifiers_from_modules(self, unique_ids: List[str]) -> List[str]:
"""
Expand module identifiers into their constituent file identifiers.

Takes a list of identifiers that may include module directories, finds all files
within those modules, and replaces the module identifiers with individual file paths.

Args:
unique_ids: List of identifiers, may include both files and modules (ending with '/')

Returns:
Expanded list with module identifiers replaced by their constituent file identifiers
"""
modules_identifiers = [
unique_id for unique_id in unique_ids if self._is_subdirectory(unique_id)
]
identifiers_per_module = self.get_module_identifiers(module_ids=modules_identifiers)

unique_ids = [
unique_id for unique_id in unique_ids
if unique_id not in modules_identifiers
]
for identifiers in identifiers_per_module.values():
unique_ids.extend(identifiers)

return unique_ids

def precheck(self, unique_ids: List[str]) -> Dict[Path, str]:
"""
Preprocess and validate identifiers before further operations.

Expands any module identifiers into their constituent files and validates
that all identifiers correspond to actual files.

Args:
unique_ids: List of file or module identifiers to precheck

Returns:
Dictionary mapping validated file paths to their identifier strings
"""
unique_ids = self.inject_identifiers_from_modules(unique_ids)
return self._precheck_id_is_file(unique_ids)

def _precheck_id_is_file(self, unique_ids : List[str])->Dict[Path, str]:
"""
Preload file contents for the given IDs if they correspond to known files.
Expand Down Expand Up @@ -580,7 +690,7 @@ def get(
f"Formats: string={as_string}, list={as_string_list}"
)

requested_files = self._precheck_id_is_file(code_identifiers)
requested_files = self.precheck(code_identifiers)
return self.codebase.get(
unique_id=code_identifiers,
degree=context_depth,
Expand All @@ -600,8 +710,6 @@ def _as_file_paths(self, code_identifiers: Union[str, List[str]])->List[str]:
as_file_paths.append(code_identifier)
elif element := self.codebase.cached_elements.get(code_identifier):
as_file_paths.append(element.file_path)
else: ### covers new files
as_file_paths.append(element)

return as_file_paths

Expand All @@ -615,8 +723,11 @@ def get_unique_paths(path_list):
unique_paths = []

for path in path_list:
# Normalize the path to use OS-appropriate separators
normalized = os.path.normpath(path)
if isinstance(path, str) and path.endswith("/"):
normalized = path
else:
# Normalize the path to use OS-appropriate separators
normalized = os.path.normpath(path)

# Only add if we haven't seen this normalized path before
if normalized not in seen:
Expand Down
Loading
Loading