Skip to content

Conversation

@ereslibre
Copy link
Collaborator

Refactors pre-context handling to skip injection during the first workflow iteration. This prevents unnecessary pre-context information from being added when the agent is just starting its work, improving the initial prompt clarity.

The pre-context injection logic has been extracted into a dedicated function that checks the iteration number before injecting pre-context file paths into workflow step prompts.

Changes

  • Extracted handlePreContextInjection() function to centralize pre-context file loading, validation, and injection logic
  • Added iteration detection by reading iteration.json to determine if this is the first iteration
  • Skip pre-context injection when iteration === 1 to avoid polluting initial prompts
  • Improved code organization by separating pre-context handling from main command logic
  • Added user-friendly console messages to indicate when pre-context injection is skipped

Notes

This change maintains backward compatibility - pre-context files are still validated and tracked on the first iteration, but the file path information is only injected into workflow prompts starting from the second iteration onwards.

@ereslibre ereslibre self-assigned this Nov 28, 2025
@ereslibre ereslibre added this to the v1.7 milestone Nov 28, 2025
Copy link
Contributor

@Angelmmiguel Angelmmiguel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Angelmmiguel
Copy link
Contributor

I'm going to merge this @ereslibre as I will use this for #310

@Angelmmiguel Angelmmiguel merged commit 38610f0 into main Nov 28, 2025
4 checks passed
@Angelmmiguel Angelmmiguel deleted the ereslibre/skip-inject-pre-context-first-iteration branch November 28, 2025 10:46
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.

3 participants