Skip to content

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

Description

@ashishsinghbora

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions