Files
memex/peripheral-vision-plan.md

33 lines
2.0 KiB
Markdown

# Implementation Plan: Component IV - Peripheral Vision Extraction
## Objective
Implement a sophisticated "Foveal-Peripheral" context model. This ensures the agent has high-resolution focus on the current task (Foveal) while maintaining a low-resolution "skeletal" awareness of the broader Memex structure (Peripheral), optimized for token efficiency and reasoning accuracy.
## Key Files & Context
- **Target:** `projects/org-agent/literate/context.org` (Source of `src/context.lisp`)
- **Core Concept:** Deep pruning of the Org AST based on semantic distance and structural hierarchy.
## Implementation Steps
### 1. Identify Foveal Focus
- Extend the `SIGNAL` structure processing to identify a `target-id` (the current headline being operated on).
### 2. Implement Tree Pruning (`context-extract-peripheral-vision`)
- Create a recursive function that walks the Object Store starting from the root (or active projects).
- **Rule A (Foveal):** If the node matches `target-id`, include it and its immediate children in **Full Resolution** (Content + Attributes).
- **Rule B (Peripheral):** For ancestors and siblings of the target, include only **Title and ID**.
- **Rule C (Background):** For unrelated nodes, omit entirely or include only at Level 1.
### 3. AST to Org Renderer (`context-render-to-org`)
- Implement a serializer that transforms our `org-object` structures back into valid Org-mode strings.
- This allows the LLM to "see" the Memex in its native habitat.
### 4. Integrate with `context-assemble-global-awareness`
- Update this function to use the new extraction and rendering logic.
- Ensure it respects a maximum token/character budget to prevent context overflow.
## Phase E: Chaos (Verification)
- **Structural Test:** Verify that ancestors are rendered as "skeletons" (no body text).
- **Foveal Test:** Verify that the target node is rendered with its full body text.
- **Budget Test:** Verify that the output string stays within defined limits even for large Memex structures.