-
Notifications
You must be signed in to change notification settings - Fork 50
feat: add lessons learned reference and update session scripts #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # Lessons Learned And Memory Archive | ||
|
|
||
| This reference is the single source of truth for the optional curated memory file: | ||
|
|
||
| - `llmdoc/memory/lessons-learned.md` | ||
|
|
||
| The file is a compact index of reusable behavioral rules distilled from accumulated memory files. It is useful when a project has accumulated enough memory that future sessions should read a summary instead of every raw note. | ||
|
|
||
| ## Trigger | ||
|
|
||
| During `/llmdoc:update`, automatically run a memory summary/archive pass when active memory files exceed 5. | ||
|
|
||
| Active memory files are files under `llmdoc/memory/` excluding: | ||
|
|
||
| - `llmdoc/memory/lessons-learned.md` | ||
| - `llmdoc/memory/doc-gaps.md` | ||
| - anything under `llmdoc/memory/archive/` | ||
|
|
||
| The threshold check should happen after the new task reflection is written, so the newest lesson is included. | ||
|
|
||
| ## What Belongs Here | ||
|
|
||
| Use `memory/lessons-learned.md` for: | ||
|
|
||
| - cross-task rules that should change future agent behavior | ||
| - recurring engineering discipline | ||
| - repeated workflow mistakes and their corrected rule | ||
| - source-linked lessons extracted from one or more reflections | ||
|
|
||
| Do not use it for: | ||
|
|
||
| - raw task narratives, which belong in `memory/reflections/` | ||
| - durable decisions, which belong in `memory/decisions/` | ||
| - missing-doc inventory, which belongs in `memory/doc-gaps.md` | ||
| - full workflow instructions, which belong in `guides/` | ||
|
|
||
| ## Archive Rule | ||
|
|
||
| When the threshold is crossed: | ||
|
|
||
| 1. Read the active memory files. | ||
| 2. Extract compact, actionable, recurring rules. | ||
| 3. Add or revise matching entries in `memory/lessons-learned.md`. | ||
| 4. Link each entry back to the source memory file before moving it. | ||
| 5. Move summarized raw memory files into `llmdoc/memory/archive/YYYY-MM-DD/`. | ||
| 6. Leave unsummarized active memory files in place if they still need direct follow-up. | ||
| 7. Do not duplicate the same instruction across prompts, agents, README files, and stable docs. | ||
|
|
||
| This is a memory compaction step, not a stable-doc rewrite. Promote a lesson into `must/`, `guides/`, `architecture/`, or `reference/` only when it is mature enough to become stable project guidance. | ||
|
|
||
| If the count is 5 or lower, do not update `lessons-learned.md` just because a single task produced a useful rule. Let raw reflections accumulate until the archive threshold is crossed. | ||
|
|
||
| ## Template | ||
|
|
||
| ```md | ||
| # Lessons Learned | ||
|
|
||
| Curated cross-task rules distilled from archived memory. | ||
|
|
||
| ## <Theme> | ||
|
|
||
| ### <Rule Name> | ||
| **Rule**: One actionable sentence. | ||
| **Why**: One sentence naming the failure, correction, or discovery that produced the rule. | ||
| **Source**: `llmdoc/memory/archive/YYYY-MM-DD/<source-file>.md` | ||
| ``` | ||
|
|
||
| ## Hook Reinforcement | ||
|
|
||
| Hooks may remind the assistant that the active-memory count crossed the archive threshold, but the detailed behavior should stay here. |
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current
findcommand is inefficient because it traverses the entirearchive/directory only to filter out its contents. Additionally, sinceset -eis active, any error (such as a permission denied error on a subdirectory) will cause the hook script to terminate prematurely. Using-pruneto skip the archive directory and redirectingstderrto/dev/nullmakes the script more robust and performant as the project history grows.