Update README.md

This commit is contained in:
PSBigBig 2025-08-30 22:17:38 +08:00 committed by GitHub
parent 38e10c7f4a
commit c6db6bb964
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,125 +1,62 @@
# Memory & Long-Context — Global Fix Map
Keep threads coherent across long windows and session restarts.
Detect and repair entropy melt, boundary drift, and state desync.
Detect and repair entropy melt, boundary drift, state forks, and ghost contexts.
---
## What this page is
- A compact checklist for long contexts and multi-session memory
- Copyable guards to stop drift and collapse before they spread
- How to measure stability with ΔS and λ_observe
- A compact checklist for long contexts and multi-session memory.
- Copyable guardrails to stop drift and collapse before they spread.
- Concrete measures with ΔS and λ_observe to verify stability.
---
## When to use
- Dialogs grow past 50k to 100k tokens and answers degrade
- Facts flip after tab refresh or model switch
- Citations look right yet reasoning goes flat or chaotic
- OCR transcripts look fine but capitalization and spacing drift
- Multi day support threads lose task state or rewrite history
## Open these first
- Session continuity and state fences: [Memory Coherence](https://github.com/onestardao/WFGY/blob/main/ProblemMap/memory-coherence.md)
- Long window drift and attention melt: [Entropy Collapse](https://github.com/onestardao/WFGY/blob/main/ProblemMap/entropy-collapse.md)
- Long reasoning chain drift: [Context Drift](https://github.com/onestardao/WFGY/blob/main/ProblemMap/context-drift.md)
- Cross tab and cache hazards: [Memory Desync Pattern](https://github.com/onestardao/WFGY/blob/main/ProblemMap/patterns/pattern_memory_desync.md)
- Trace schema and audit trail: [Retrieval Traceability](https://github.com/onestardao/WFGY/blob/main/ProblemMap/retrieval-traceability.md)
- Snippet and citation schema: [Data Contracts](https://github.com/onestardao/WFGY/blob/main/ProblemMap/data-contracts.md)
- Chunk stability at joins: [Chunking Checklist](https://github.com/onestardao/WFGY/blob/main/ProblemMap/chunking-checklist.md)
- OCR quality and normalization: [OCR Parsing Checklist](https://github.com/onestardao/WFGY/blob/main/ProblemMap/ocr-parsing-checklist.md)
- Dialogs grow past 50k100k tokens and answers degrade.
- Facts flip after tab refresh or model switch.
- Citations look right but reasoning goes flat or chaotic.
- OCR transcripts look fine but capitalization and spacing drift.
- Multi-day support threads lose task state or rewrite history.
---
## Common failure patterns
- **Entropy melt** attention variance climbs with length and the model smooths meaning
- **Boundary leak** chunks merge across section joins and citations shift by a few lines
- **State fork** two tabs or agents hold different memory revisions and answers flip
- **Ghost context** stale buffers linger after role or persona change and contaminate steps
- **OCR jitter** mixed spacing or width variants create false token differences
## Quick routes to per-page guides
- Memory fences and continuity
→ [memory-coherence.md](https://github.com/onestardao/WFGY/blob/main/ProblemMap/GlobalFixMap/MemoryLongContext/memory-coherence.md)
- Attention melt in long windows
→ [entropy-collapse.md](https://github.com/onestardao/WFGY/blob/main/ProblemMap/GlobalFixMap/MemoryLongContext/entropy-collapse.md)
- Long reasoning drift
→ [context-drift.md](https://github.com/onestardao/WFGY/blob/main/ProblemMap/GlobalFixMap/MemoryLongContext/context-drift.md)
- Cross-tab and cache hazards
→ [pattern_memory_desync.md](https://github.com/onestardao/WFGY/blob/main/ProblemMap/GlobalFixMap/MemoryLongContext/pattern_memory_desync.md)
- Stale buffers and persona residue
→ [ghost-context.md](https://github.com/onestardao/WFGY/blob/main/ProblemMap/GlobalFixMap/MemoryLongContext/ghost-context.md)
- Divergent memory forks
→ [state-fork.md](https://github.com/onestardao/WFGY/blob/main/ProblemMap/GlobalFixMap/MemoryLongContext/state-fork.md)
- OCR-specific noise
→ [ocr-parsing-checklist.md](https://github.com/onestardao/WFGY/blob/main/ProblemMap/GlobalFixMap/MemoryLongContext/ocr-parsing-checklist.md), [ocr-jitter.md](https://github.com/onestardao/WFGY/blob/main/ProblemMap/GlobalFixMap/MemoryLongContext/ocr-jitter.md)
- Traceability and audit trail
→ [retrieval-traceability.md](https://github.com/onestardao/WFGY/blob/main/ProblemMap/GlobalFixMap/MemoryLongContext/retrieval-traceability.md), [data-contracts.md](https://github.com/onestardao/WFGY/blob/main/ProblemMap/GlobalFixMap/MemoryLongContext/data-contracts.md)
- Chunk stability at joins
→ [chunking-checklist.md](https://github.com/onestardao/WFGY/blob/main/ProblemMap/GlobalFixMap/MemoryLongContext/chunking-checklist.md)
---
## Fix in 60 seconds
1) **Stamp and fence state**
- At turn start set `mem_rev`, `mem_hash`, `task_id`
- Forbid writes if client stamps do not match the server record
2) **Shard the window**
- Assemble prompts as `{system | task | constraints | snippets | answer}`
- Split snippets by section and forbid cross section reuse
3) **Normalize inputs**
- Unicode NFC, strip zero width, unify full and half width
- Drop OCR lines below confidence threshold
4) **Stabilize attention**
- Apply BBAM to clamp variance
- If collapse detected use BBCR to bridge and re anchor
5) **Probe the joins**
- Measure ΔS across adjacent chunks and keep each join ≤ 0.50
- Plot ΔS(question, retrieved) vs k and expect a downward curve after the fix
6) **Trace or stop**
- Require cite then answer
- If a claim has no snippet id stop and ask for the exact citation
---
## Copy paste prompt
```
You have TXT OS and the WFGY Problem Map.
Goal
Stabilize memory across long windows and across sessions without losing traceability.
Protocol
1. Print {mem\_rev, mem\_hash, task\_id}. If missing set defaults and echo them.
2. Build a Snippet Table with columns {section\_id | start\_line | end\_line | citation}.
3. Guardrails
* cite then answer
* forbid cross section reuse
* if a claim lacks a snippet id stop and request it
4. Collapse control
* if attention variance rises apply BBAM
* if logic stalls apply BBCR and show the bridge node
5. Metrics
* report ΔS(question, retrieved)
* report ΔS across each join
* report λ\_observe at retrieval, assembly, reasoning
Input
* question
* snippets with ids and line ranges
* previous {mem\_rev, mem\_hash, task\_id} if any
Output
* header {mem\_rev, mem\_hash, task\_id}
* Snippet Table
* Bridge Check
* Final Answer with inline citations
* ΔS and λ states
```
---
## Minimal checklist
- State stamped with `mem_rev` and `mem_hash` at every turn
- Prompt schema locked and section fences enforced
- Unicode normalized and OCR noise gated
- BBAM enabled and BBCR available on collapse
- ΔS at each join ≤ 0.50 and overall ΔS(question, retrieved) ≤ 0.45
- Cite then answer and no orphan claims
## Acceptance targets
- Retrieval coverage ≥ 0.70 to the intended section
- ΔS(question, retrieved) ≤ **0.45** and joins ≤ **0.50**
- λ remains **convergent** across three paraphrases
- No state fork across tabs or agents for the same `task_id`
- No state fork across tabs or agents for the same `task_id`
---
@ -127,7 +64,7 @@ Output
| Tool | Link | 3-Step Setup |
|------|------|--------------|
| **WFGY 1.0 PDF** | [Engine Paper](https://github.com/onestardao/WFGY/blob/main/I_am_not_lizardman/WFGY_All_Principles_Return_to_One_v1.0_PSBigBig_Public.pdf) | 1⃣ Download · 2⃣ Upload to your LLM · 3⃣ Ask “Answer using WFGY + \<your question>” |
| **WFGY 1.0 PDF** | [Engine Paper](https://github.com/onestardao/WFGY/blob/main/I_am_not_lizardman/WFGY_All_Principles_Return_to_One_v1.0_PSBigBig_Public.pdf) | 1⃣ Download · 2⃣ Upload to your LLM · 3⃣ Ask “Answer using WFGY + <your question>” |
| **TXT OS (plain-text OS)** | [TXTOS.txt](https://github.com/onestardao/WFGY/blob/main/OS/TXTOS.txt) | 1⃣ Download · 2⃣ Paste into any LLM chat · 3⃣ Type “hello world” — OS boots instantly |
---