fix(context): refresh workspace state after tool-driven file changes

Open
#15 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
ai, tooling

Research direction

Trace how MiniAgent constructs WorkspaceContext and the generated prompt prefix, then follow the write_file, patch_file, and run_shell operations that can mutate the workspace. Check how later model turns obtain git status, branch state, commits, documentation, and repository instructions. Done means a mutation is visible on the next model turn, static prompt content is not needlessly rebuilt, and regression tests cover the sequence.

Written by the indexing model from the issue text.

Description

Problem

"WorkspaceContext" and the generated prompt prefix are constructed once when "MiniAgent" starts. However, tools such as "write_file", "patch_file", and "run_shell" can mutate the workspace during the same session.

As a result, subsequent model turns can receive stale information about:

  • "git status"
  • current branch state
  • recent commits
  • project documentation
  • repository-level instructions

For example, the initial workspace may be clean, but after "write_file" creates a file, the prompt can still report the original clean status.

Expected behavior

After workspace-mutating operations, the agent should either:

  1. refresh the affected workspace context, or
  2. explicitly separate immutable context from dynamically refreshed state.

The refresh should avoid rebuilding unnecessary static prompt content on every turn.

Acceptance criteria

  • "git status" reflects changes made during the current session.
  • Changes made through "write_file", "patch_file", and shell commands are visible to later model turns.
  • Project documentation changes are reflected when appropriate.
  • Existing prompt/cache behavior is preserved as much as possible.
  • Add regression tests covering a workspace mutation followed by another model turn.
Dominant language
Python
Stars
1.2k
Forks
210
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rasbt/mini-coding-agent

All issues in rasbt/mini-coding-agent

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.