feat: Enhance memory management and promotion rules for Mattermost context and user prompts

This commit is contained in:
2026-04-09 15:11:43 -06:00
parent 060f6dfc00
commit 22198a6c6f
11 changed files with 277 additions and 16 deletions

View File

@@ -26,6 +26,15 @@ async function resolveSyncCommand(directory) {
}
}
async function resolveSyncContent(directory, stdoutText) {
const cleaned = (stdoutText || "").trim()
if (cleaned) return cleaned
const generatedPath = path.join(directory, "scripts/mattermost/generated/mattermost_context.jsonl")
const generated = await safeRead(generatedPath)
return (generated || "").trim()
}
export const MattermostInbox = async ({ $, directory, client }) => {
let lastSyncAt = 0
@@ -54,7 +63,8 @@ export const MattermostInbox = async ({ $, directory, client }) => {
try {
await mkdir(inboxDir, { recursive: true })
const output = (await $`bash -lc ${command}`.text()).trim()
const stdoutText = await $`bash -lc ${command}`.text()
const output = await resolveSyncContent(directory, stdoutText)
const previous = await safeRead(latestPath)
if (output) {