Files
agentic-resources/workplans/AGENTIC-WP-0007-session-memory-phase3.md
tegwick 00e8958540 session-memory: scoping + proposals + active registry (WP-0007 T04)
distribute/proposals.py: Scope-aware targeting (FR-X2, empty axis = any), render
distributable (approved+distribution_ready) patterns into a proposals/ tree
mirroring target paths — proposed not applied (FR-X3, HITL), idempotent on re-run.
ActiveRegistry (FR-X4) records which pattern+version is proposed in which
(repo,flavor). 6 new tests; suite 123/123.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-07 15:09:40 +02:00

101 lines
3.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
id: AGENTIC-WP-0007
type: workplan
title: "Coding Session Memory — Phase 3 (Distribute: per-flavor artifacts, HITL)"
domain: helix_forge
repo: agentic-resources
status: ready
owner: codex
topic_slug: helix-forge
created: "2026-06-07"
updated: "2026-06-07"
state_hub_workstream_id: "766c9089-d5de-472a-8c0f-85529028cfb9"
---
# Coding Session Memory — Phase 3 (Distribute)
Implements **Distribute** (PRD §6.4, FR-X1FR-X4), continuing
[AGENTIC-WP-0004](AGENTIC-WP-0004-session-memory-phase2.md) (Curate). Distributor
adapters render the **approved / `distribution_ready`** SolutionPatterns from the
Pattern Catalog into per-flavor artifacts, using the `rendering_hints` produced in
Phase 2. Mirror image of the collector design: **agnostic core, thin adapters at
the edges** (FR-A2) — adding a flavor = one collector + one distributor.
Key boundary (FR-X3): output is **proposed, not auto-applied** — artifacts are
written as reviewable proposals (HITL), scoped by repo/domain (FR-X2), with an
active-pattern registry tracking which patterns are live where (FR-X4).
## Distributor Adapter Interface + Artifact Base
```task
id: AGENTIC-WP-0007-T01
status: done
priority: high
state_hub_task_id: "ff618fa6-a78b-4b80-846b-8cde7ad65451"
```
Define a `Distributor` protocol and an `Artifact` dataclass (flavor, target_path,
content, pattern_id) in `session_memory/distribute/`. `render(pattern, scope)`
reads the agnostic `SolutionPattern` plus its per-flavor `rendering_hints`; base
helpers handle idempotent snippet markers. Agnostic core; flavor logic only in
adapters. Unit-tested.
## Claude Distributor (CLAUDE.md snippet)
```task
id: AGENTIC-WP-0007-T02
status: done
priority: high
state_hub_task_id: "64f50bd4-1fdf-452e-ae14-890253ab9f33"
```
`distribute/claude.py`: render an approved pattern into a `CLAUDE.md` snippet block
(or skill stub) with stable `BEGIN/END` markers so re-distribution updates in
place rather than duplicating. Uses `rendering_hints["claude"]`. Unit-tested.
## Codex + Grok Distributors
```task
id: AGENTIC-WP-0007-T03
status: done
priority: high
state_hub_task_id: "382790f5-1fb4-4394-b039-1649cbf3b20a"
```
`distribute/codex.py` (`AGENTS.md` snippet) and `distribute/grok.py` (native
instruction format), each rendering the *same* agnostic pattern via its
`rendering_hints`. Confirms FR-A3: a pattern discovered via one flavor is
expressible for all. Unit-tested.
## Scoping + Proposed-Not-Applied Output + Active-Pattern Registry
```task
id: AGENTIC-WP-0007-T04
status: done
priority: high
state_hub_task_id: "2c690f29-2aee-460a-b9cd-3566018f6b3c"
```
Filter patterns by `Scope` (repos/domains/flavors) so a pattern only lands where it
applies (FR-X2). Write artifacts as **proposals** under a `proposals/` dir, never
auto-applied (FR-X3, HITL). Track which patterns are active in which environments
in an active-pattern registry (FR-X4). Unit-tested.
## Distribute Entrypoint + Tests + Verify
```task
id: AGENTIC-WP-0007-T05
status: todo
priority: medium
state_hub_task_id: "f9e24c13-7049-4c1c-a2d6-3a4dc4e752fd"
```
`python -m session_memory.distribute`: read approved catalog patterns, render
per-flavor proposals scoped by repo/domain, emit a proposal summary + JSON.
Document in `session_memory/README.md`. Verify end-to-end against the real catalog.
After workplan updates, notify the operator to run from `~/state-hub`:
```bash
make fix-consistency REPO=agentic-resources
```