Skip to content

Phase 1 MVP: Discord auto-archive + trim + manual recall#83

Merged
drpedapati merged 19 commits intomainfrom
feature/discord-memory-phase1-mvp
Feb 27, 2026
Merged

Phase 1 MVP: Discord auto-archive + trim + manual recall#83
drpedapati merged 19 commits intomainfrom
feature/discord-memory-phase1-mvp

Conversation

@drpedapati
Copy link
Owner

@drpedapati drpedapati commented Feb 27, 2026

Summary

Implements the first functional Discord memory slice:

  • Auto-archive and trim for over-limit Discord sessions
  • Manual lexical recall via CLI
  • Config and session-manager plumbing
  • Agent-loop integration test for auto-archive trigger
  • Fix recall behavior when --session-key is omitted (scan all archives)

Commits

  • e095b5d Add Discord archive config and session manager snapshot APIs
  • eea4b13 Add Discord archive manager with trim and lexical recall
  • 1a21de4 Add archive discord CLI commands for list run recall
  • 93ebf51 Trigger Discord auto-archive in agent loop with integration test
  • 2ffcaf3 Fix Discord recall when session-key filter is omitted

Validation

  • go test ./pkg/archive/discordarchive ./cmd/picoclaw -count=1
  • go test ./pkg/agent -run TestProcessDirectWithChannel_DiscordAutoArchiveTrim -count=1
  • make build-all
  • Dev release + Homebrew upgrade path validated:
    • v0.1.66-dev.2 published
    • brew upgrade sciclaw-dev succeeds
    • sciclaw --version shows v0.1.66-dev.2
  • Live CLI smoke tests (dev binary):
    • archive discord list works
    • archive discord run --session-key ... archives + trims
    • archive discord recall "..." now works both with and without --session-key
    • Agent LLM calls verified (direct + tool-call flow)

Notes

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 27, 2026

Deploying sciclaw with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4c333d1
Status: ✅  Deploy successful!
Preview URL: https://8f1924e5.sciclaw.pages.dev
Branch Preview URL: https://feature-discord-memory-phase.sciclaw.pages.dev

View logs

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 93ebf519fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if err != nil {
return nil
}
safeKey := sanitizeSessionKey(sessionKey)

Choose a reason for hiding this comment

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

P1 Badge Skip session-key sanitization when recall key is empty

When sessionKey is omitted, sanitizeSessionKey returns "unknown", so the later filename filter treats this as an active key filter and drops almost every archive file. In practice, archive discord recall <query> without --session-key returns no hits even when matching archives exist, which breaks the default/manual recall path.

Useful? React with 👍 / 👎.

if !strings.HasSuffix(name, ".md") {
continue
}
if safeKey != "" && !strings.Contains(name, safeKey) {

Choose a reason for hiding this comment

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

P2 Badge Match session archives by exact key token, not substring

Filtering archive files with strings.Contains(name, safeKey) can pull in unrelated sessions whose sanitized keys share prefixes (for example, querying discord:12 also matches discord:123). This contaminates recall results with the wrong conversation history whenever session identifiers overlap.

Useful? React with 👍 / 👎.

@drpedapati
Copy link
Owner Author

Update after recall bugfix + release validation:

  • Added fix for no-filter recall path (2ffcaf3): archive discord recall now scans all archived sessions when --session-key is not provided.
  • Added regression test: TestRecallWithoutSessionKeyScansAllArchives.
  • Published dev release: v0.1.66-dev.2.
  • Verified Homebrew dev upgrade path end-to-end:
    • brew upgrade sciclaw-dev
    • active binary now reports v0.1.66-dev.2
  • Live smoke tests passed:
    • archive list/run/recall
    • recall works both with and without --session-key
    • agent live LLM calls validated (direct response + tool call path)

@drpedapati
Copy link
Owner Author

Phase 2 update pushed: af96a1d

What’s now in this PR:

  • Discord auto-recall injection in agent loop before LLM call.
  • Strict bounded recall section budget (chars/tokens capped).
  • Fail-open path when recall retrieval fails.
  • Non-Discord channel behavior unchanged.

Tests added:

  • TestProcessDirectWithChannel_DiscordAutoRecallInjectedAfterArchiveExists
  • TestProcessDirectWithChannel_DiscordAutoRecallInjectionCappedByBudget
  • TestProcessDirectWithChannel_DiscordAutoRecallFailureIsFailOpen
  • TestProcessDirectWithChannel_NonDiscordNoAutoRecallInjection

Targeted test run passed (archive + phase2 agent-loop tests).

@drpedapati drpedapati merged commit 4c333d1 into main Feb 27, 2026
4 of 5 checks passed
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.

1 participant