Skip to content

Conversation

@AojdevStudio
Copy link

Summary

This PR introduces a self-improving memory system that closes the feedback loop for THEALGORITHM, implementing the "Solve Once, Reuse Forever" principle from the PAI philosophy.

New Tools

Tool Purpose
LearningCapture.ts Captures capability performance, estimation accuracy, and patterns from completed ISCs
SignalCapture.ts Tracks failures, loopbacks, and user ratings in JSONL format
PreFlightCheck.ts Pre-flight advisor that consults past learnings at algorithm start

Key Features

  • Hybrid Scoring Algorithm: (ContextMatch × 0.4) + (OutcomeWeight × 0.3) + (RecencyDecay × 0.3)
  • Pattern Analysis: Identifies recurring failures, loopbacks, and success patterns
  • Natural Language Synthesis: Max 5 learnings synthesized to avoid cognitive overload
  • Non-blocking Advisor Pattern: Informs decisions without blocking execution

How It Works

Algorithm Start → PreFlightCheck → Load learnings → Analyze patterns → 
Generate recommendations → Inject into OBSERVE phase context

Usage Examples

# Run pre-flight check at algorithm start
bun run PreFlightCheck.ts check --request "Add authentication"

# Capture learnings after completing work
bun run ISCManager.ts learn

# Record signals during execution
bun run SignalCapture.ts failure -w "task" -c "tests pass" -e "all green" -o "3 failing"

Research Background

This implementation synthesizes insights from:

  • Two Loops Algorithm (Miessler) - Outer Loop (Current→Desired) + Inner Loop (7-phase scientific method)
  • SAOR Schema - Situation-Action-Outcome-Reflection for structured learnings
  • Episodic Memory Patterns - Remembering "how to accomplish tasks" via few-shot examples
  • Staged Retrieval Pipeline - Filter → Candidates → Rerank for precision + recall

Files Changed

  • 3 new tools in Packs/pai-algorithm-skill/src/skills/THEALGORITHM/Tools/
  • ISCManager.ts: Added learn and preflight commands
  • Learn.md: Updated documentation with learning capture workflow

Test Plan

  • PreFlightCheck reads from all MEMORY locations
  • Scoring produces relevant results (not random)
  • Output is synthesized natural language
  • CLI works standalone (bun run PreFlightCheck.ts check)
  • ISCManager integration works (bun run ISCManager.ts preflight)

🤖 Generated with Claude Code

This PR introduces a self-improving memory system that closes the feedback loop
for THEALGORITHM, implementing the "Solve Once, Reuse Forever" principle.

New Tools:
- LearningCapture.ts: Captures capability performance, estimation accuracy, and patterns
- SignalCapture.ts: Tracks failures, loopbacks, and user ratings in JSONL format
- PreFlightCheck.ts: Pre-flight advisor that consults past learnings at algorithm start

Key Features:
- Hybrid scoring algorithm: (ContextMatch × 0.4) + (OutcomeWeight × 0.3) + (RecencyDecay × 0.3)
- Pattern analysis for failures, loopbacks, and successes
- Natural language synthesis (max 5 learnings to avoid cognitive overload)
- Non-blocking advisor pattern - informs decisions without blocking execution

Updated Files:
- ISCManager.ts: Added 'learn' and 'preflight' commands
- Learn.md: Updated documentation with learning capture workflow

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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