Skip to content

Commit 61314af

Browse files
authored
Merge pull request #34 from BrunoV21/improved-context
Improved context
2 parents e269b82 + 61c1a7b commit 61314af

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

codetide/agents/tide/agent.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ async def agent_loop(self, codeIdentifiers :Optional[List[str]]=None):
222222

223223
codeIdentifiers = self.contextIdentifiers or []
224224
if self.modifyIdentifiers:
225-
codeIdentifiers.extend(self.tide._as_file_paths(self.modifyIdentifiers))
225+
self.modifyIdentifiers = self.tide._as_file_paths(self.modifyIdentifiers)
226+
codeIdentifiers.extend(self.modifyIdentifiers)
226227

227228
# --- End Unified Identifier Retrieval ---
228229
if codeIdentifiers:

codetide/agents/tide/prompts.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@
430430
- Write solutions or code modifications
431431
- Access actual identifier definitions
432432
- Acknowledge that viewing file contents is outside your scope
433+
- Use markdown formatting, bold text, italics, headers, code blocks, or any special formatting whatsoever
433434
434435
**YOUR SOLE PURPOSE:** Gather required identifiers superficially and minimally based only on file/directory structure and naming patterns.
435436
@@ -505,9 +506,9 @@
505506
**MANDATORY OUTPUT FORMAT**
506507
507508
**RESPONSE STRUCTURE (STRICT):**
508-
- Begin with a single short paragraph that briefly explains your reasoning. Keep it concise, direct, and to the point - no extended detail, no repetition, no looping. Plain text only, no labels, headers, or formatting.
509-
- Then output the required blocks exactly as shown below.
510-
- **Do NOT include any section headers, labels, or headings such as "Analysis and Decision Rationale:" or similar. Only output the explanation and the required blocks.**
509+
- Begin with a single short paragraph in plaint text that briefly explains your reasoning. Keep it concise, direct, and to the point - no extended detail, no repetition, no looping. Plain text only with no formatting, no labels, headers, bold text, italics, code blocks, asterisks, underscores, or any markdown syntax.
510+
- Then output the required blocks exactly as shown below using only plain text.
511+
- **Do NOT** include any section headers, labels, headings, formatting, or markdown syntax such as "Analysis and Decision Rationale:" or similar. Only output the explanation and the required blocks in plain text format.
511512
512513
**Identifier Sections:**
513514
```

codetide/agents/tide/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def parse_blocks(text: str, block_word: str = "Commit", multiple: bool = True) -
3939
"""
4040
Extract content between *** Begin <block_word> and *** End <block_word> markers (exclusive),
4141
ensuring that both markers are at zero indentation (start of line, no leading spaces).
42+
Handles trailing spaces after the block_word.
4243
4344
Args:
4445
text: Full input text containing one or more blocks.
@@ -52,8 +53,9 @@ def parse_blocks(text: str, block_word: str = "Commit", multiple: bool = True) -
5253
# Escape the block_word to handle any special regex characters
5354
escaped_word = re.escape(block_word)
5455

55-
# Create pattern with the parameterized block word
56-
pattern = rf"(?m)^\*\*\* Begin {escaped_word}\n([\s\S]*?)^\*\*\* End {escaped_word}$"
56+
# Create pattern with the parameterized block word, allowing trailing spaces
57+
# \s* allows for zero or more whitespace characters after the block_word
58+
pattern = rf"(?m)^\*\*\* Begin {escaped_word}\s*\n([\s\S]*?)^\*\*\* End {escaped_word}\s*$"
5759
matches = re.findall(pattern, text)
5860

5961
if not matches:

0 commit comments

Comments
 (0)