You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 70269f0
Browse filesBrowse the repository at this point in the historyBrowse files
fix(memory): the "remembered" chip shows only when the note was saved
rememberNoteTool answered `verified: false` both for an unconfirmed note that was saved and for a
note that was not saved at all (no folder open, or the store refused the write), and the agent
posted "🧠 remembered: … (unconfirmed)" for all three. The person saw a memory that did not exist.
The host now also returns `saved`, and the agent posts the chip only when it is true. The agent is
still told what happened in the tool result.
dbg('sessions.memory.remember',{ kind,verified: g.verified,reason: g.reason,grounded: Math.round(g.grounded*100)/100, ok });
1543
-
if(!ok){return{verified: false,message: 'ERROR: the note could not be saved.'};}
1543
+
if(!ok){return{saved: false,verified: false,message: 'ERROR: the note could not be saved.'};}
1544
1544
refreshMemoryViews();
1545
1545
if(g.verified){
1546
-
return{verified: true,message: 'Remembered as the user\'s '+kind+' note. It is in this project\'s memory now and in every future session. No need to repeat it back at length.'};
1546
+
return{saved: true,verified: true,message: 'Remembered as the user\'s '+kind+' note. It is in this project\'s memory now and in every future session. No need to repeat it back at length.'};
1547
1547
}
1548
1548
constwhy=g.reason==='not-said' ? 'the quoted words were not found in what the user typed this run'
1549
1549
: g.reason==='adds-to-what-was-said' ? 'the note says more than the quoted words do'
1550
1550
: g.reason==='reorders-what-was-said' ? 'the note puts the quoted words in a different order'
1551
1551
: g.reason==='changes-a-not' ? 'the note drops or adds a not/never the quoted words do not have'
1552
1552
: 'the quoted words are too short to credit';
1553
-
return{verified: false,message: 'Saved as UNCONFIRMED ('+why+'). It is listed in the Memory tab and has no effect until the user confirms it there. If the user did ask for this, quote their exact words in `said` and keep the note to what they said, in their order, with every not/never they used.'};
1553
+
return{saved: true,verified: false,message: 'Saved as UNCONFIRMED ('+why+'). It is listed in the Memory tab and has no effect until the user confirms it there. If the user did ask for this, quote their exact words in `said` and keep the note to what they said, in their order, with every not/never they used.'};
1554
1554
}
1555
1555
// The forget tool's host half: removes the best-matching note or fact, when the person's own words ask for it.
constr=awaitrun('From now on always use pnpm, never npm.',[
123
123
call('read_file',{path: 'README.md',explanation: 'Read the readme'}),
124
124
call('ask_user',{questions: [{header: 'Scope',question: 'Only this repo?',options: [{label: 'Only this repo'},{label: 'Everywhere'}]}]}),
@@ -130,6 +130,17 @@ const host = new Function('env', [
130
130
assert.ok(r.posted.some((m)=>m.type==='agentTool'&&m.text==='🧠 remembered: Use pnpm, never npm, in this repo'));
131
131
assert.strictEqual(r.results[2],'Remembered.');
132
132
});
133
+
awaittestAsync('AGENT: no "remembered" chip when nothing was saved — no folder, or the write failed',async()=>{
134
+
for(constrof[{saved: false,verified: false,message: 'No project memory is available in this workspace (open a folder). Nothing was saved.'},
135
+
{saved: false,verified: false,message: 'ERROR: the note could not be saved.'}]){
136
+
constout=awaitrun('always use pnpm, never npm',[call('remember',{kind: 'preference',text: 'Use pnpm',said: 'always use pnpm'})],{memoryNotes: {remember: ()=>r,forget: ()=>({})}});
assert.strictEqual(out.results[0],r.message,'the agent is told what happened');
139
+
}
140
+
constkept=awaitrun('always use pnpm, never npm',[call('remember',{kind: 'preference',text: 'Push to main',said: 'always use pnpm'})],
141
+
{memoryNotes: {remember: ()=>({saved: true,verified: false,message: 'Saved as UNCONFIRMED.'}),forget: ()=>({})}});
142
+
assert.ok(kept.posted.some((m)=>m.type==='agentTool'&&m.text==='🧠 remembered: Push to main (unconfirmed)'),'an unconfirmed note that was saved still shows');
143
+
});
133
144
awaittestAsync('AGENT: a remember without the person\'s words, or without a note, is refused before the host sees it',async()=>{
0 commit comments