feat: add lessons learned reference and update session scripts#27
Conversation
Introduced a new reference file for lessons learned to serve as a curated memory archive. Updated session start and stop scripts to incorporate checks for active memory files and summarize lessons when the threshold is exceeded.
There was a problem hiding this comment.
Code Review
This pull request introduces a structured memory archiving system for the llmdoc skill. It adds a new reference document defining the archival process, updates the session start hook to include the lessons-learned summary in the context, and modifies the stop hook to monitor active memory files and trigger archival reminders when the count exceeds five. A review comment suggested optimizing the file counting logic in the stop hook to improve performance and robustness by using the -prune flag and suppressing error output.
| active_memory_count="$( | ||
| find "$project_dir/llmdoc/memory" -type f \ | ||
| ! -path "$project_dir/llmdoc/memory/archive/*" \ | ||
| ! -name "lessons-learned.md" \ | ||
| ! -name "doc-gaps.md" \ | ||
| | wc -l \ | ||
| | tr -d '[:space:]' | ||
| )" |
There was a problem hiding this comment.
The current find command is inefficient because it traverses the entire archive/ directory only to filter out its contents. Additionally, since set -e is active, any error (such as a permission denied error on a subdirectory) will cause the hook script to terminate prematurely. Using -prune to skip the archive directory and redirecting stderr to /dev/null makes the script more robust and performant as the project history grows.
| active_memory_count="$( | |
| find "$project_dir/llmdoc/memory" -type f \ | |
| ! -path "$project_dir/llmdoc/memory/archive/*" \ | |
| ! -name "lessons-learned.md" \ | |
| ! -name "doc-gaps.md" \ | |
| | wc -l \ | |
| | tr -d '[:space:]' | |
| )" | |
| active_memory_count="$(find "$project_dir/llmdoc/memory" -path "$project_dir/llmdoc/memory/archive" -prune -o -type f ! -name "lessons-learned.md" ! -name "doc-gaps.md" -print 2>/dev/null | wc -l | tr -d '[:space:]')" |
|
再更新下小版本吧, 可以直接合并 @wh1teAlter |
Introduced a new reference file for lessons learned to serve as a curated memory archive. Updated session start and stop scripts to incorporate checks for active memory files and summarize lessons when the threshold is exceeded.