A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Give a group's memory only to its current members
Fei24115e42c3d38c3d
diff --git a/ds-bot/src/host/memory.js b/ds-bot/src/host/memory.jsindex ac0d5eb3..b20eee3b 100644--- a/ds-bot/src/host/memory.js+++ b/ds-bot/src/host/memory.js@@ -1052,7 +1052,8 @@ export function install(rt) {if (decision.kind === 'reject' || signal?.aborted || !Array.isArray(decision.messages)) return decisionawait rt.load()const roomId = roomIdOf(agent.id)- if (roomId === undefined || rt.botOf(rt.selfOf(agent.id)) === undefined) return decision+ const bot = rt.botOf(rt.selfOf(agent.id))+ if (roomId === undefined || bot === undefined || !rt.roomOf(roomId)?.members.includes(bot.id)) return decisionif (sectionFor(agent.id).includes(GROUP_HEADING) || decision.messages.some(isGroupMemory)) return decisiontry {if (agent.session?.deriveMessages?.().some(isGroupMemory)) return decisiondiff --git a/ds-bot/test/memory.test.js b/ds-bot/test/memory.test.jsindex 90ba492e..7f5b0812 100644--- a/ds-bot/test/memory.test.js+++ b/ds-bot/test/memory.test.js@@ -1647,7 +1647,7 @@ test('the members of a group read its memory in their Sessions there, and no Bottest('in a group, remember and forget write the group memory unless told otherwise, for any member', async (t) => {const home = mkdtempSync(join(tmpdir(), 'ds-bot-memory-'))twoMembers(home)- const { tool, call, read, journal, stop } = start({ home })+ const { ctx, tool, call, read, journal, stop } = start({ home })t.after(() => stop())assert.match(await tool('remember', { text: 'Builds go in the out folder' }, 'g2'), /^Saved to the group memory, in MEMORY\.md \(MEMORY\.md: \d+ of 4000 characters\)\. Every member sees it in its next conversation in this group; recall finds it now\.$/)assert.match(read('groups', 'r1', 'MEMORY.md'), /- Builds go in the out folder \[source: group "Launch" \d{2}-\d{2} \d{2}:\d{2}; by: Writer; added: /)@@ -1668,6 +1668,9 @@ test('in a group, remember and forget write the group memory unless told otherwiassert.equal((await call('update-room', { id: 'r1', remove: ['b2'] })).ok, true)await assert.rejects(tool('remember', { text: 'Still here' }, 'g2'), /Only Bots on the team keep a memory\./)await assert.rejects(tool('forget', { entry: 'Friday' }, 'g2'), /Only Bots on the team keep a memory\./)+ // Nor does it read it: its Session there gets no snapshot of the group's memory.+ assert.equal(await groupMemoryOf(ctx, 'g2'), undefined)+ assert.ok(await groupMemoryOf(ctx, 'g3'))assert.deepEqual(parseMemory(read('groups', 'r1', 'MEMORY.md')).entries.map(entry => entry.text), ['Ship on Friday'])})