From 4bfe5d25cfe76678e13286bbf03f728e566e4905 Mon Sep 17 00:00:00 2001 From: Kisa Date: Tue, 23 Jun 2026 21:22:31 -0400 Subject: [PATCH] chore(state): clean-start current-state.md, ignore context recovery artifacts, add workflow-consolidation brief for Pi Commit the previously-uncommitted current-state.md (left dirty by an interrupted wrap-up), gitignore the heavy context recovery files (screenshot/jsonl/snapshot), and add the consolidated Pi design brief for the shared-state + workflow cleanup. Co-Authored-By: Claude Opus 4.8 (1M context) --- .gitignore | 5 ++ context/current-state.md | 15 +++-- ...workflow-consolidation-brief-2026-06-23.md | 64 +++++++++++++++++++ 3 files changed, 78 insertions(+), 6 deletions(-) create mode 100644 docs/workflow-consolidation-brief-2026-06-23.md diff --git a/.gitignore b/.gitignore index f2f23c1..ea7c308 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,8 @@ node_modules/ .venv/ supabase/ graphify-out/ + +# context folder: keep current-state.md + the brief, ignore heavy recovery artifacts +context/*.png +context/*.jsonl +context/recovery-snapshot-*.md diff --git a/context/current-state.md b/context/current-state.md index 52161b0..6bc6edb 100644 --- a/context/current-state.md +++ b/context/current-state.md @@ -1,28 +1,31 @@ # current-state ACTIVE: Readiness-model redesign locked + design brief written for Pi. Client supplies plan type (Signal never determines payer/eligibility/coverage); cite-the-basis; patient/CoverageLine/Shipment data model; required-vs-supplied verdict (no false green). cto-architect review folded in. -NEXT: Pi produces the build design from `docs/readiness-model-brief-2026-06-23.md`; then Claude builds (sequence: rename coverage->readiness, rules-to-config, patient/line/shipment grouping + verdict, device-keyed override+recompute, require-plan-type + client mapping + remove guesser, frontend nesting). RECONCILE: 2026-06-23 call says the anonymous patient ID should be rotating (not static) - tension with the persistent worklist keyed on patient_id; Pi to address. +NEXT: Pi produces the build design from `docs/readiness-model-brief-2026-06-23.md`; then Claude builds (sequence: rename coverage->readiness, rules-to-config, patient/line/shipment grouping + verdict, device-keyed override+recompute, require-plan-type + client mapping + remove guesser, frontend nesting). Pi has RESOLVED the tension of a rotating anonymous patient ID vs. persistent worklist by proposing the RAP-ID/CSP-ID architecture. -## Decisions (last 6) +Pi has also refined strategic plans for a "Signal AIOS" for clients and an "Automated Blog" for the STTIL Solutions website, incorporating Granola call insights for API-first strategy, SEO tools, and agent orchestration. + +## Decisions (last 7) - 2026-06-23: Readiness model redesign. Signal never determines/guesses payer plan type, eligibility, or coverage; client supplies plan type as a required mapped field; every determination cites the rule + client input. Worklist = one record per patient UUID with per-device CoverageLines; verdict from required-vs-supplied (Clear to Ship earned by positive evidence, never by absent data). MA "bug" = delete the name-guesser. "coverage" code renamed to "readiness". Brief: docs/readiness-model-brief-2026-06-23.md. KG: plan_type_policy, scope_exclusion, determination_explainability. +- 2026-06-23: RAP-ID/CSP-ID architectural solution proposed by Pi to reconcile rotating anonymous patient ID with persistent worklist tracking. Web App (SaaS Hosted by STTIL) is the recommended deployment model, with client-side management of Real Patient ID to CSP-ID mapping; HIPAA-compliant host like Validated Cloud is still required. - 2026-06-23: Shield architecture designed by Pi (standalone compliance product, tiered deployment, security, scalability, AI Consent Addendum focus). Ready for Claude Code build or further refinement. - 2026-06-23: DNSSEC verified live (DS propagated to public resolvers, ad flag set = chain validating). Website agent-files: staged compliance/factual fixes in local repo, NOT deployed: removed outreach wording, banned >25% stat, exposed pricing; fixed SWO term to Standard Written Order; refreshed learn-signal SKILL.md digest in agent-skills index. Prose rewrites + v0.2.0 field polish route to lead-content / deferred (agentskills.io schema URL unreachable). -- 2026-06-23: Pi drafted strategic plans for "Signal AIOS" (productizing Shield's compliance architecture for Signal clients) and an "Automated Blog" for STTIL Solutions website (AI/SEO optimized, leveraging research agents and TriLane). Awaiting Granola call notes for refinement and Claude Code's recommendations. +- 2026-06-23: Pi drafted strategic plans for "Signal AIOS" (productizing Shield's compliance architecture for Signal clients) and an "Automated Blog" for STTIL Solutions website (AI/SEO optimized, leveraging research agents and TriLane). These plans have been refined based on Granola call insights, emphasizing API-first strategy, specific SEO tools (AnswerThePublic, Schema.org), and agent orchestration concepts. Awaiting Claude Code's recommendations for implementation. - 2026-06-22: Phase 4 (support bot foundation) spec written by Pi — gen-api-ref.py + manual cross-reference. Ready for Claude Code build. - 2026-06-22: Build Spec Phase 2 built (Claude Code). navaigate-session-brain now auto-writes current-state.md (Step 3B) + extracts research insights to TriLane (Step 3C). Clerk prod migration COMPLETE (pk_live on Vercel + JWKS on Railway). ## Open Threads (max 5) - READINESS MODEL REDESIGN (2026-06-23): design brief for Pi at `docs/readiness-model-brief-2026-06-23.md` (folds in cto-architect review). Pi produces the build design; then Claude builds. Supersedes the piecemeal 3-blockers framing. KG added: plan_type_policy, scope_exclusion, determination_explainability. -- TODAY'S CALL shared for Pi (2026-06-23, AI OS / API-first w/ Fred, Daniel, Andres): notes at `STTIL-Vault/Projects/Meetings/2026-06-23-AI operating system design and API-first architecture with Fred, Daniel, and Andres.md` (also auto-flows to TriLane sessions ws 3446107c-..., Pi reaches over HTTP at 127.0.0.1:8000). Signal-relevant: new federal EO tightens AI + identifiable health data; rotating anonymous patient ID (NOT static) - reconcile vs persistence keyed on patient_id; Validated Cloud HIPAA host; local on-client inference option; API-first connectors to Brightree/NikoHealth. +- SIGNAL AIOS & AUTOMATED BLOG STRATEGIC PLANS (2026-06-23): Pi has refined these plans based on Granola call insights. Claude Code to review and make recommendations for moving forward. - LabABLE Meeting Fri 2026-06-26 1:30 PM — /pilot-prep (deferred). - Website copy: brief lead-content for human-page rewrites (extract "eligibility"/"coverage" language, stat consistency), run copy-review, then commit + deploy the staged agent-file fixes. Retention 6-year doc fix (2 stale "7 year" lines). BAA privacy wording attorney-gated. - Build Spec Phase 4 (support bot foundation) spec by Pi - ready for Claude Code build. ## Stack -- Signal: PHI contained in `patient_id` field (name, MRN, account #s) — requires tokenization (2026-06-23 call: rotating anonymous ID, not static UUID). +- Signal: PHI contained in `patient_id` field (name, MRN, account #s) — requires tokenization via proposed RAP-ID/CSP-ID architecture (2026-06-23 call: rotating anonymous ID, not static UUID; PROBLEM RESOLVED BY PI). - Model for Pi: `deepseek/deepseek-v4-flash` (cheap, high-thinking). Subagents also default to this model. - Signal-api: Railway (signal-api-production-91c2) - Signal-ui: Vercel (signal-ui-xi.vercel.app) @@ -34,4 +37,4 @@ NEXT: Pi produces the build design from `docs/readiness-model-brief-2026-06-23.m TriLane Memory has the `research_insight` category live in the Signal workspace. Session summaries live in the Sessions workspace (auto-flow), not Signal. Meeting/Granola notes also land in the Sessions workspace; Pi can query them over HTTP. -## Updated: 2026-06-23 (Claude Code + Kisa: locked the readiness-model redesign via brainstorming + cto-architect review; wrote the design brief for Pi at docs/readiness-model-brief-2026-06-23.md; added KG facts plan_type_policy/scope_exclusion/determination_explainability; shared today's AI-OS call notes for Pi; flagged the rotating-ID vs persistence tension. Next: Pi designs the build, then Claude builds.) +## Updated: 2026-06-23 (Claude Code + Kisa: locked the readiness-model redesign via brainstorming + cto-architect review; wrote the design brief for Pi at docs/readiness-model-brief-2026-06-23.md; added KG facts plan_type_policy/scope_exclusion/determination_explainability; shared today's AI-OS call notes for Pi; flagged the rotating-ID vs persistence tension. Next: Pi designs the Readiness Model build; Pi integrates Granola insights into AIOS/Automated Blog plans. Next: Claude builds diff --git a/docs/workflow-consolidation-brief-2026-06-23.md b/docs/workflow-consolidation-brief-2026-06-23.md new file mode 100644 index 0000000..4e302c1 --- /dev/null +++ b/docs/workflow-consolidation-brief-2026-06-23.md @@ -0,0 +1,64 @@ +# Pi Design Brief — Workflow Consolidation + +**Date:** 2026-06-23 +**Designs:** Pi (full design) · **Builds:** Claude Code · **Approves:** Kisa +**Goal:** Stop spending build time on plumbing. Convert every recurring manual protocol that drifts into a skill or hook, so the workflow self-maintains and we get back to building Signal and Shield. +**Principle:** Anywhere a protocol drifts, the fix is a skill or a hook, not a human reminder. + +--- + +## Findings (grounded — do not re-discover) + +- **Skills are already shared.** Claude and Pi both read from `~/.claude/skills/SKILL_NAME/SKILL.md`. Pi has no separate skills directory. Add a skill once → both tools have it. The only drift is a hand-maintained skill *table* inside `~/.pi/agent/AGENTS.md` (a stale ~9-skill subset) and separate MCP configs (`~/.pi/agent/mcp.json` vs Claude's). `graphify` and `use-railway` are Claude-only. +- **The wrap-up commit+push exists but is a fragile manual chain.** It is Step 5 of `navaigate-session-brain` ("runs automatically every session"), but it only fires if a human triggers the wrap-up and the session does not crash first. Evidence: `context/current-state.md` was left uncommitted and a `terminal-freeze-screenshot.png` sits beside it — a session updated state (Step 3B) but died before pushing (Step 5). The skill also swallows push failures silently ("note and continue"). +- **State is triplicated and drifts.** `context/current-state.md` (freshest, auto-written) vs the embedded "Current State" block in `signal/CLAUDE.md` (already disagreeing today) vs `project_next_steps.md` in Claude memory. The harness auto-injects whole CLAUDE.md files into context, so stale state in that block keeps loading even when nobody reads it on purpose. + +## Decisions already locked — do not re-litigate + +- **State source of truth = one git-versioned file per repo: `context/current-state.md`.** signal `origin` = Forgejo (canonical), `github` = mirror. +- **Both agents read from git:** `git pull --rebase` then read the file. Write = write → commit → push. Matched pair; reading from git is only fresh if every wrap-up pushes. +- **The embedded "Current State" block in `CLAUDE.md` is demoted to a one-line pointer** (zero rolling fields). Required because the harness auto-injects CLAUDE.md. +- **Skills stay in the shared `~/.claude/skills/` directory.** No skill-sync system to build. +- **Not an API, not TriLane-as-live-store.** TriLane stays the searchable archive. +- **Housekeeping done this session:** `context/*.png`, `context/*.jsonl`, `context/recovery-snapshot-*.md` added to `.gitignore`; `current-state.md` committed clean. + +--- + +## What Pi designs (five workstreams) + +### 1. The state contract +Format for `current-state.md`: fixed sections, a `v:1` schema marker, an `Updated:` timestamp line, author tags (`[Pi]`/`[CC]`) on every Decisions-log line, and a hard size budget (whole file reads in well under ~2k tokens). Provide a fill-in template. Plus: +- **De-duplication map** — one home per info type. Starting boundary: volatile working state → `current-state.md`; stable project facts (what Signal is, PHI rules, run commands, checklists) → `CLAUDE.md`; Kisa/CC operating notes → Claude memory; history/insights → TriLane. Rule of thumb: changes every session → current-state.md; true for months → CLAUDE.md; "what happened" → TriLane. +- **Read protocol** (start): `git pull --rebase`, read the file, surface a **staleness signal** ("state is N days old" from the `Updated:` line). Kisa opens the same file; no separate human path. +- **Write protocol** (wrap): single mutable ACTIVE/NEXT head; append-only, author-stamped Decisions log; `pull --rebase` → write → commit → push; before writing, re-check the `Updated:` line and rebase-reconcile if it moved. +- **Concurrency:** on a rare ACTIVE/NEXT conflict, last writer hand-merges (never `-X ours`, never a lock file). +- **Disagreement rule:** while the old block still exists, `current-state.md` wins; demote it in the same change. + +### 2. Reliable wrap-up commit + push (the real fix) +Make state-to-git automatic so a crash or a skipped wrap-up cannot lose state. Pi weighs and recommends: +- A **Stop hook** in `settings.json` (the harness runs it when a session ends, with no human trigger) that commits + pushes `current-state.md` — the strongest option because it fires regardless of whether anyone says "wrap up." +- and/or a lightweight **launchd safety-net** that commits + pushes any dirty `current-state.md` on a timer. +- Either way: **make push failures visible** (stop silently swallowing them) and keep the existing session-brain Step 5 as the rich path. +Pi specifies the exact mechanism, where it lives, and how it behaves for both Claude and Pi. + +### 3. Skills + MCP parity (Claude ↔ Pi) +Keep the shared `~/.claude/skills/` directory as the single skill library. Then: +- **Eliminate or auto-generate** the hand-maintained skill table in `~/.pi/agent/AGENTS.md` so it cannot drift from the real directory (e.g., a one-line "read any skill from `~/.claude/skills/` by name" plus an optional generated index). +- **Decide MCP parity:** one source of truth for MCP servers, or a sync step, so adding a server to one tool reaches the other. Note `graphify`/`use-railway` stay Claude-only. + +### 4. Drift-to-skill governance +A standing rule plus a short catalog: list the recurring manual protocols that currently rely on a human remembering (session start reads, wrap-up, git-push, content-calendar pull, KG queries, etc.) and say which should become a skill, a hook, or stay manual. Output is a small decision table Claude can build from. + +### 5. Cleanup / smoother workflow +The broader housekeeping: collapse the triplicated state into the de-dup map above, retire stale rolling sections from the mission brief and CLAUDE.md, and define one coherent start/wrap protocol shared by both agents. Keep one `current-state.md` per repo, not a global file. + +--- + +## Constraints +- Lean and token-conscious above all — net startup reads go DOWN. +- Plain-text, human-readable. One file per repo. No PHI in state files. +- No new running services beyond (optionally) one Stop hook and/or one launchd safety-net. +- Schema versioning is a single `v:1` marker — no migration tooling. + +## Deliverable +A short design doc (2–3 pages): the `current-state.md` schema + filled template; the read/write protocol steps ready to drop into the shared skill; the de-dup map; the recommended wrap-up automation mechanism (hook and/or launchd) with exact placement; the skills/MCP parity fix; the drift-to-skill decision table; and the exact startup edits for both `CLAUDE.md` and `~/.pi/agent/AGENTS.md`.