NeuriCo Context and Working-Memory Improvements - #154
Open
Yashtik wants to merge 3 commits into
Open
Conversation
Add a Research Contract north star in STATE.md, agent-side directory checks at phase boundaries, and per-phase handoff files so agents keep focused working memory without drifting off task.
Add a dedicated docs page covering the Research Contract, directory checks, and phase handoffs, and link it from the README and workflow guide.
Keep the explanation in the PR description instead of adding another markdown file to the repo.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NeuriCo Context and Working-Memory Improvements
Contribution toward #51 — Context management and working memory.
Long research runs are difficult for AI agents. As the conversation grows, an agent can forget the original research goal, lose track of decisions made earlier, or start creating files in the wrong folder.
This contribution adds three lightweight safeguards to help NeuriCo’s research agents stay organised during long runs.
1. Keeping the research goal visible
Each project’s
STATE.mdnow includes a NeuriCo-controlled Research Contract containing the original:The agent is told to treat this contract as its north star throughout the run. If experimental evidence contradicts the hypothesis, it should report that honestly rather than trying to prove the hypothesis.
STATE.mdalso gives stage notes a consistent structure:This makes handoffs between major pipeline stages clearer and reduces vague or incomplete progress notes.
2. Checking the agent’s working directory
During an experiment, the agent may temporarily enter folders such as:
That is normal. The problem occurs when it forgets to return to the project root before beginning the next phase. New files may then be saved in unexpected locations.
A new command,
neurico-check-dir, checks the agent’s actual shell directory and classifies it as:At every phase boundary, the agent is instructed to run the checker. If it is nested or outside, it must return to the workspace root, rerun the checker, and continue only after receiving exit code 0.
Checks are recorded and summarized in
STATE.md.This is prompt-enforced rather than a hard programmatic gate: the command objectively checks the directory when invoked, but the agent could theoretically skip it.
3. Adding phase-to-phase handoffs
The Experiment Runner completes six phases in one continuous session:
Planning → Setup → Implementation → Experiments → Analysis → Documentation
To prevent earlier decisions from getting buried, the agent now writes one concise handoff file after each phase:
Before starting the next phase, the agent rereads the Research Contract and the immediately previous handoff.
Each handoff records completed work, decisions, evidence, unresolved issues, and next steps. Important unresolved context is carried forward, while irrelevant details can be dropped.
Together, these changes help the agent remember what it is trying to accomplish, where it should be working, and what happened during the previous phase.
Test plan
pytestsuite passed locallyneurico-check-diris available after install