feat: archive beans for project memory instead of deleting#30
Merged
Conversation
- Add `.beans/archive/` directory for storing completed/scrapped beans - `beans archive` now moves beans instead of deleting them - Add `--with-archived` global flag to include archived beans in queries - Automatically unarchive beans when updating them via `beans update` - Update file watcher to conditionally watch archive directory - Update agent prompt with guidance on using archived beans for context - Add comprehensive tests for archive functionality Archived beans serve as project memory, preserving past decisions and completed work that agents can reference for context.
Since archiving now moves files instead of deleting them, the operation is reversible and doesn't need confirmation. Remove: - The --force flag - The confirmation prompt - The printBeanList helper function
* origin/main: refactor(prompt): simplify agent instructions template (#31)
* main: fix: cleanup prompt
- Add `normalizeID` helper to deduplicate prefix-handling logic - Refactor `findBeanLocked` and `GetFromArchive` to use the new helper - Fix race condition in `LoadAndUnarchive` by holding lock throughout - Add early-return for already-loaded beans (idempotency)
Since archiving is now non-destructive (beans moved to .beans/archive/ instead of deleted), we no longer need to remove incoming links when archiving. Relationships are preserved and accessible via --with-archived. - Remove RemoveLinksTo call from archive command - Update help text to reflect that relationships are preserved - Add follow-up bean for fixing broken links (beans-3kd3) Refs: beans-3kd3
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.
Summary
This PR replaces the destructive
beans archivecommand with a non-destructive archiving system that preserves beans as project memory.Key Changes
.beans/archive/instead of being deleted--with-archivedglobal flag: Include archived beans in any query (works withbeans list,beans query, etc.)beans update <archived-id>automatically unarchives the beanImplementation Details
Core.Archive()/Core.Unarchive()methods to move beans between main and archive directoriesCore.SetWithArchived(bool)controls whether archived beans are loadedCore.LoadAndUnarchive()for the update command's auto-unarchive behaviorCore.GetFromArchive()to check archive without loading all archived beansnormalizeIDhelper to deduplicate ID prefix-handling logicAgent Prompt Updates
Updated
cmd/prompt.tmplwith:--with-archivedto access project memoryWhy This Matters
Archived beans serve as project memory for AI agents, helping them:
Test plan
beans archivemoves beans to.beans/archive/instead of deletingbeans listexcludes archived beans by defaultbeans list --with-archivedincludes archived beansbeans query --with-archivedincludes archived beansbeans update <archived-id> --status todounarchives the bean