Skip to content

Dev - #13

Merged
MEKXH merged 22 commits into
mainfrom
dev
Feb 25, 2026
Merged

Dev#13
MEKXH merged 22 commits into
mainfrom
dev

Conversation

@MEKXH

@MEKXH MEKXH commented Feb 25, 2026

Copy link
Copy Markdown
Owner

No description provided.

MEKXH and others added 22 commits February 20, 2026 13:03
This change modifies the agent loop to execute multiple tool calls from a single LLM response concurrently. This significantly reduces latency when multiple tools are invoked (e.g., parallel web searches).

- Use `sync.WaitGroup` to execute tools in parallel.
- Collect results and preserve original order for deterministic conversation history.
- Ensure thread safety in `RuntimeMetrics` by holding the lock during file persistence to prevent race conditions and file corruption.
- Add regression test `internal/agent/loop_parallel_test.go`.

Co-authored-by: MEKXH <59291264+MEKXH@users.noreply.github.com>
- Use `lipgloss` to style `golem status` output for better readability.
- Add structured headers and status indicators (OK/Ready/Enabled).
- Sort provider names alphabetically for deterministic output.
- Update `status_test.go` to handle ANSI codes in assertions.

Co-authored-by: MEKXH <59291264+MEKXH@users.noreply.github.com>
Improved the `golem status` command output by using `lipgloss` for
styling. The output now features colored headers, status indicators
(Green for OK/Ready, Red/Orange for issues), and a more structured
layout. Also sorted the provider names to ensure consistent output
order. Updated unit tests to strip ANSI codes before verifying the
output content.

---
*PR created automatically by Jules for task
[5831958722610558236](https://jules.google.com/task/5831958722610558236)
started by @MEKXH*
💡 What: Parallelized tool execution in the agent loop.
🎯 Why: Multiple tool calls (e.g., search for X, search for Y) were
executed sequentially, causing unnecessary latency.
📊 Impact: Reduces total execution time to approximately the duration of
the longest single tool call + overhead.
🔬 Measurement: Added `internal/agent/loop_parallel_test.go` which shows
a drop from ~300ms to ~100ms for 3 concurrent 100ms tasks.

---
*PR created automatically by Jules for task
[10507193342825563532](https://jules.google.com/task/10507193342825563532)
started by @MEKXH*
Refactored internal/metrics/runtime.go to use a buffered persistence mechanism.
Metrics are now aggregated in memory and flushed to disk every 5 seconds or on shutdown,
significantly reducing I/O overhead on hot paths (tool execution, channel sends, memory recall).

Also fixed a race condition in internal/agent/context.go where a new RuntimeMetrics instance
was created for every memory recall, potentially overwriting existing metrics.

Updated tests to ensure proper flushing before assertion.

Co-authored-by: MEKXH <59291264+MEKXH@users.noreply.github.com>
This change updates the chat TUI to display the name of the tool currently being executed in the "Thinking..." status line.

Instead of a generic "Thinking..." message, users will now see "Running tool: <tool_name>..." when a tool is active. This provides better feedback during long-running operations.

- Added `currentTool` field to the `model` struct.
- Updated `Update` function to track tool start/finish events.
- Updated `View` function to render the current tool name.

Co-authored-by: MEKXH <59291264+MEKXH@users.noreply.github.com>
Improved the chat TUI to show the name of the tool currently being
executed in the status line, replacing the generic "Thinking..." message
with "Running tool: <name>..." during tool execution.

---
*PR created automatically by Jules for task
[10891149783252333392](https://jules.google.com/task/10891149783252333392)
started by @MEKXH*
Confirmed that the async persistence logic is correct and handled the trade-offs regarding data safety.
No code changes required as the implementation already includes proper locking and shutdown flushing.

Co-authored-by: MEKXH <59291264+MEKXH@users.noreply.github.com>
💡 What: Replaced synchronous file I/O in `RuntimeMetrics` with an
asynchronous buffered mechanism.
🎯 Why: Writing to disk on every tool execution, channel send, and memory
recall was a performance bottleneck and caused race conditions.
📊 Impact: Eliminates blocking I/O on the main execution path. Reduces
disk writes significantly (from N per operation to 1 per 5s).
🔬 Measurement: Verified with `go test ./...` ensuring data consistency
and proper flushing behavior.


---
*PR created automatically by Jules for task
[3019394804830486941](https://jules.google.com/task/3019394804830486941)
started by @MEKXH*
- Implement caching in `ContextBuilder` for base system prompt parts (IDENTITY.md, skills, etc.)
- Use `sync.RWMutex` for thread-safe access and lazy initialization
- Invalidate cache in `Loop` when file modification tools are executed
- Reduces file reads by ~5-8 per interaction turn for read-only operations

Co-authored-by: MEKXH <59291264+MEKXH@users.noreply.github.com>
Adds a persistent help footer to the chat interface displaying key bindings:
"Enter: Send • /new: Reset • Esc: Quit".

This improves discoverability of controls for new users.

Changes:
- Added `helpStyle` using standard gray color (241).
- Updated `model.View()` to render the help footer.
- Updated `model.Update()` to account for footer height in layout calculations.

Co-authored-by: MEKXH <59291264+MEKXH@users.noreply.github.com>
💡 **What:** Implemented a caching mechanism for static context files
(`IDENTITY.md`, `SOUL.md`, `USER.md`, `TOOLS.md`, `AGENTS.md`) and the
skills summary within `ContextBuilder`.

🎯 **Why:** The agent was re-reading these files and scanning the
`skills` directory on every single interaction turn (LLM request),
causing unnecessary disk I/O and latency.

📊 **Impact:** Reduces file reads by approximately 5-8 per turn (plus
directory scanning) for read-only operations.

🔬 **Measurement:** Verified by running tests and ensuring correctness.
The cache is invalidated whenever a file modification tool
(`write_file`, `edit_file`, `append_file`) is executed, ensuring the
agent sees updates immediately.

---
*PR created automatically by Jules for task
[10997106390676720511](https://jules.google.com/task/10997106390676720511)
started by @MEKXH*
Added a help footer to the TUI chat interface to improve usability and
discoverability of keyboard shortcuts. This micro-UX improvement aligns
with the "Helpful Additions" guideline.

---
*PR created automatically by Jules for task
[18231820318946761350](https://jules.google.com/task/18231820318946761350)
started by @MEKXH*
This change optimizes the agent's performance by reducing unnecessary I/O when files are modified. Previously, the system prompt cache was invalidated on every file modification. Now, it is only invalidated if the modified file is one of the base context files (e.g., IDENTITY.md) or resides in the skills directory.

* internal/agent/context.go: Update InvalidateCache to check modified file path. Factor out watchedBaseFiles constant.
* internal/agent/loop.go: Parse file path from tool arguments and pass to InvalidateCache.
* internal/agent/context_invalidation_test.go: Add test for selective invalidation.
* .jules/bolt.md: Add performance learning.

Co-authored-by: MEKXH <59291264+MEKXH@users.noreply.github.com>
💡 What: Replaced the plain text help footer in the chat UI with a structured, styled footer using 'keycap' visuals for shortcuts.
🎯 Why: Improves discoverability of keyboard shortcuts (Enter, /new, Esc) and visual hierarchy.
📸 Before: "Enter: Send • /new: Reset • Esc: Quit" (plain text)
After: [Enter] Send  [/new] Reset  [Esc] Quit (distinct keys)
♿ Accessibility: Increased contrast and clarity for keyboard interactions.

Co-authored-by: MEKXH <59291264+MEKXH@users.noreply.github.com>
Enhanced the TUI footer in the chat command to use styled keycaps for
better visibility of keyboard shortcuts. Also ran `go fmt` on the
codebase.

---
*PR created automatically by Jules for task
[4652110494344087594](https://jules.google.com/task/4652110494344087594)
started by @MEKXH*
Implemented selective cache invalidation for the agent's context
builder. This prevents rebuilding the system prompt and rescanning
skills when the agent modifies files that do not affect the static
context (e.g., source code files). This optimization reduces disk I/O
and latency during coding tasks involving multiple file edits.

Verification:
- Added `TestContextBuilder_InvalidateCache_Selective` to verify correct
invalidation logic.
- Ran all tests in `internal/agent` package.

---
*PR created automatically by Jules for task
[6739839929126926116](https://jules.google.com/task/6739839929126926116)
started by @MEKXH*
Implemented a caching mechanism for ChatMessage rendering in the TUI to prevent unnecessary re-renders. This significantly improves performance for long chat histories, especially during window resizing or minor updates.

The cache is validated against content, width, and tool execution state to ensure correctness.

Fixes #performance-bottleneck-tui-render

Co-authored-by: MEKXH <59291264+MEKXH@users.noreply.github.com>
- Add `PgUp/Dn` and `Ctrl+C` to the TUI help footer to improve discoverability of navigation and quit actions.
- Add a "↓ Scrolled Up" visual indicator when the viewport is not at the bottom, alerting users to hidden content.
- Increase the truncation limit for tool execution output from 50 to 200 characters, providing more context in the chat history.

Co-authored-by: MEKXH <59291264+MEKXH@users.noreply.github.com>
This change enhances the UX of the CLI chat interface by:
1. Making navigation keys (PgUp/Dn) and alternative quit keys (Ctrl+C)
explicit in the help footer.
2. Adding a visual cue when the user has scrolled up to view history.
3. Showing more of the tool execution output (200 chars vs 50 chars) to
give users better context without overwhelming the UI.

---
*PR created automatically by Jules for task
[2727580876848174977](https://jules.google.com/task/2727580876848174977)
started by @MEKXH*
💡 What: Added caching to `renderMessage` in `cmd/golem/commands/chat.go`
to store rendered content and reuse it if inputs haven't changed.
🎯 Why: Rendering markdown with `glamour` and styling with `lipgloss` is
CPU intensive. Re-rendering the entire chat history on every update
causes UI lag as the conversation grows.
📊 Impact: Reduces re-render time for historical messages to near zero,
making the UI responsive even with hundreds of messages.
🔬 Measurement: Verified with `go test ./...` and manual inspection of
code logic. Cache invalidation is robust against content changes and
window resizing.

---
*PR created automatically by Jules for task
[5537121047778574940](https://jules.google.com/task/5537121047778574940)
started by @MEKXH*
@MEKXH
MEKXH merged commit 6b8d7f7 into main Feb 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant