Problem Description
The PAI-OpenCode plugin is creating work sessions for every single user interaction, including trivial messages like greetings ("hello"), acknowledgments ("thanks"), and ratings ("8/10"). This results in hundreds of empty work sessions with no valuable content.
Current Behavior
- 97 work sessions created in just 48 hours of normal usage
- All sessions contain only empty templates:
ISC.json: {"criteria": [], "anti_criteria": []}
THREAD.md: Just header template, no conversation
META.yaml: Status "COMPLETED" with no context
- Zero learning captured from assistant responses or user feedback
Expected Behavior (Per PAI Specification)
Per PAI/SKILL.md, work sessions should only be created based on conversation depth:
| Depth |
Content |
Create Session? |
| FULL |
Problem-solving, implementation, design |
✅ Yes |
| ITERATION |
Continuing existing work |
✅ Yes |
| MINIMAL |
Greetings, ratings, acknowledgments |
❌ No |
Root Cause
File: plugins/handlers/work-tracker.ts:139 - createWorkSession()
// Currently creates session unconditionally
export async function createWorkSession(prompt: string) {
// No filtering - creates session for EVERY prompt
const isc = { criteria: [], anti_criteria: [] }; // Always empty!
}
Triggers: Both chat.message and event handlers call createWorkSession() without checking message content or depth.
Additional Issues
Beyond the filtering problem, there are missing features compared to original PAI:
- Assistant responses never captured - Only user messages (truncated to 200 chars) are written to THREAD.md
- No items/ subdirectory - Original PAI creates structured work items at items/001/
- ISC never populated - Empty criteria arrays, no extraction from algorithm output
- No effort tier detection - Missing QUICK/STANDARD/DEEP classification
- Ratings not linked to sessions - Ratings go to ratings.jsonl but not to the work session thread
Proposed Solutions
Phase 1: Trivial Message Filtering
Add isTrivialMessage() function to detect and skip:
- Greetings: "hello", "hi", "hey", "good morning"
- Acknowledgments: "ok", "thanks", "got it", "sounds good"
- Ratings: "8", "8/10", "9 - great work"
- Short messages: <20 characters
Phase 2: Full Conversation Capture
- Capture full user messages (not truncated)
- Add appendAssistantToThread() to capture assistant responses
- Link ratings to work sessions with context
Phase 3: Original PAI Structure
- Create items/001/ subdirectory with META.yaml, ISC.json, RESPONSE.md
- Detect effort tier (QUICK/STANDARD/DEEP) from prompt
- Extract ISC criteria from algorithm output patterns
- Add YAML frontmatter to all files
Acceptance Criteria
References
Environment
- OpenCode: v1.1.x
- PAI-OpenCode: Current main branch
- OS: Linux (tested on WSL2)
Labels
bug, memory-system, performance, enhancement
Problem Description
The PAI-OpenCode plugin is creating work sessions for every single user interaction, including trivial messages like greetings ("hello"), acknowledgments ("thanks"), and ratings ("8/10"). This results in hundreds of empty work sessions with no valuable content.
Current Behavior
ISC.json:{"criteria": [], "anti_criteria": []}THREAD.md: Just header template, no conversationMETA.yaml: Status "COMPLETED" with no contextExpected Behavior (Per PAI Specification)
Per
PAI/SKILL.md, work sessions should only be created based on conversation depth:Root Cause
File:
plugins/handlers/work-tracker.ts:139-createWorkSession()// Currently creates session unconditionallyexport async function createWorkSession(prompt: string) {// No filtering - creates session for EVERY promptconst isc = { criteria: [], anti_criteria: [] }; // Always empty!}Triggers: Both chat.message and event handlers call createWorkSession() without checking message content or depth.
Additional Issues
Beyond the filtering problem, there are missing features compared to original PAI:
Proposed Solutions
Phase 1: Trivial Message Filtering
Add isTrivialMessage() function to detect and skip:
Phase 2: Full Conversation Capture
Phase 3: Original PAI Structure
Acceptance Criteria
References
Environment
Labels
bug, memory-system, performance, enhancement