Set up Core Hub framework planning

This commit is contained in:
2026-06-27 11:00:12 +02:00
parent 8ed13623e5
commit a69df288b7
33 changed files with 1058 additions and 274 deletions

View File

@@ -1,8 +1,18 @@
## Architecture
<!-- TODO: Describe the key design decisions and component structure.
Key modules, data flows, external integrations, state machines, etc. -->
Core Hub is contract-first. The stable framework surface is defined by specs, schemas, OpenAPI, event catalogs, manifests, fixtures, and compatibility tests before implementation details harden.
Initial component model:
- Contract/IR layer: documented schemas for hubs, capabilities, manifests, widgets, events, workplans, tasks, progress, messages, decisions, and registry facts.
- Service layer: Python/FastAPI application with Pydantic v2 DTOs, SQLAlchemy async models, Alembic migrations, asyncpg/Postgres persistence, and httpx integrations.
- Compatibility layer: Inter-Hub `/api/v2` endpoint preservation where ops-hub, activity-core, and existing consumers depend on it.
- UI layer: operator console and component surfaces aligned with whynot-design patterns; prefer framework-neutral contracts and Lit/custom-element adapters where useful.
- Migration layer: data import, row-count checks, fixture replay, dual-run smokes, and production cutover gates.
## Quick Reference
`~/state-hub/mcp_server/TOOLS.md` — MCP tool reference
- `INTENT.md` - purpose and lineage
- `docs/research/2026-06-27-core-hub-lineage-and-platform-reset.md` - research artifact
- `docs/specs/README.md` - spec map
- `workplans/` - ADR-001 workplans

View File

@@ -1,38 +1,26 @@
## First Session Protocol
Triggered when `get_domain_summary("infotech")` shows **no workstreams**.
The project is registered but work has not yet been structured.
Triggered when State Hub shows no workstreams for `core-hub`.
**Step 1 Read, don't write**
- `~/the-custodian/canon/projects/infotech/project_charter_v0.1.md` — purpose, scope
- `~/the-custodian/canon/projects/infotech/roadmap_v0.1.md` — planned phases
- Scan repo root: README, directory structure, existing code or docs
**Step 1 - Read, do not write yet**
- `INTENT.md`
- `SCOPE.md`
- `docs/research/2026-06-27-core-hub-lineage-and-platform-reset.md`
- `docs/specs/README.md`
- Existing files under `workplans/`
**Step 2 Survey in-progress work**
Look for TODOs, open branches, half-finished files. Note done vs. started but incomplete.
**Step 2 - Survey in-progress work**
Look for untracked files, open workplans, and half-finished specs. Note done vs. started but incomplete.
**Step 3 — Propose workstreams to Bernd**
Propose 13 workstreams — each a coherent strand, weeks to months, anchored to a
roadmap phase. **Wait for approval before creating.**
**Step 3 - Structure work in files first**
Create or update `workplans/CORE-WP-NNNN-<slug>.md` before relying on State Hub records.
**Step 4 — Create workplan file first, then DB record (ADR-001)**
```
workplans/REPO-WP-NNNN-<slug>.md ← write this first
```
Then register in the hub:
```
create_workstream(topic_id="cee7bedf-2b48-46ef-8601-006474f2ad7a", title="...", owner="...", description="...")
create_task(workstream_id="<id>", title="...", priority="high|medium|low")
**Step 4 - Sync the read model**
After workplan changes, run from `~/state-hub`:
```bash
make fix-consistency REPO=core-hub
```
**Step 5 Record the setup**
```
add_progress_event(
summary="First session: structured infotech into N workstreams, M tasks",
event_type="milestone",
topic_id="cee7bedf-2b48-46ef-8601-006474f2ad7a",
detail={"workstreams": [...], "tasks_created": M}
)
```
<!-- Delete or archive this file once past first session -->
**Step 5 - Record progress**
Post a non-secret progress note to State Hub summarizing the setup or implementation work.

View File

@@ -1,5 +1,6 @@
**Purpose:** Git repository template to bootstrap coulomb projects.
**Purpose:** 3rd-generation production interaction framework for Coulomb / Helixforge.
**Domain:** infotech
**Repo slug:** repo-seed
**Repo slug:** core-hub
**Topic ID:** cee7bedf-2b48-46ef-8601-006474f2ad7a
**Workplan prefix:** CORE-WP-

View File

@@ -1,85 +1,48 @@
## Session Protocol
Dev Hub (State Hub API): http://127.0.0.1:8000
MCP server name in `~/.claude.json`: `dev-hub`
**Step 1 Orient**
**Step 1 - Orient**
Read the offline-safe brief first — it works without a live hub connection:
```bash
cat .custodian-brief.md
cat INTENT.md
cat SCOPE.md
ls workplans/
```
Then call the MCP tool for richer cross-domain context when MCP tools are exposed:
```
get_domain_summary("infotech")
```
If MCP tools are unavailable in the current agent session, use the REST API:
Use REST when MCP tools are unavailable:
```bash
curl -s "http://127.0.0.1:8000/state/summary" | python3 -m json.tool
curl -s "http://127.0.0.1:8000/workstreams/?topic_id=cee7bedf-2b48-46ef-8601-006474f2ad7a&status=active" | python3 -m json.tool
```
If the hub is offline: `cd ~/state-hub && make api`
**Step 2 Check inbox**
With MCP tools:
```
get_messages(to_agent="repo-seed", unread_only=True)
```
Mark read with `mark_message_read(message_id)`. Reply or act on coordination
requests before proceeding.
**Step 2 - Check inbox**
Without MCP tools:
```bash
curl -s "http://127.0.0.1:8000/messages/?to_agent=repo-seed&unread_only=true" \
| python3 -m json.tool
curl -s -X PATCH "http://127.0.0.1:8000/messages/<id>/read" \
-H "Content-Type: application/json" -d '{}'
curl -s "http://127.0.0.1:8000/messages/?to_agent=core-hub&unread_only=true" | python3 -m json.tool
```
**Step 3 — Scan workplans**
Mark read when handled.
**Step 3 - Scan workplans**
```bash
ls workplans/
```
For each file with `status: ready`, `active`, or `blocked`, note pending
`wait`/`todo`/`progress` tasks.
**Step 4 — Present brief**
For each file with `status: ready`, `active`, or `blocked`, note pending `wait`/`todo`/`progress` tasks.
1. **Active workstreams** for `infotech` — title, task counts, blocking decisions
2. **Pending tasks** from `workplans/` + any `[repo:repo-seed]` hub tasks
3. **Goal guidance** — if `goal_guidance` in summary:
- `needs_workplan`: surface as top action — *"Repo goal '{title}' has no workplan yet"*
- `alignment_warnings`: flag if active work is not aligned with current goal
4. **Suggested next action** — highest-priority open item
5. **SBOM status** — flag if `last_sbom_at` is unset for this repo
**Step 4 - Work file-first**
If no workstreams: follow First Session Protocol (`first-session.md`).
State Hub is a read/cache/index layer. Work structure belongs in repo files under ADR-001.
**During work:** `record_decision()` · `add_progress_event()` · `resolve_decision()`
**Session close**
> State Hub is a *read model*. Bootstrap tools (`create_workstream`, `create_task`)
> are First Session Protocol only. Work structure belongs in repo files (ADR-001).
**Session close:**
With MCP tools:
```
add_progress_event(summary="...", topic_id="cee7bedf-2b48-46ef-8601-006474f2ad7a", workstream_id="<uuid>")
```
Without MCP tools:
```bash
cd ~/state-hub
make fix-consistency REPO=core-hub
curl -s -X POST http://127.0.0.1:8000/progress/ \
-H "Content-Type: application/json" \
-d '{"topic_id":"cee7bedf-2b48-46ef-8601-006474f2ad7a","workstream_id":"<uuid>","event_type":"note","summary":"what changed","author":"codex"}'
-d '{"topic_id":"cee7bedf-2b48-46ef-8601-006474f2ad7a","event_type":"note","summary":"what changed","author":"codex"}'
```
If workplan files were modified, ensure the local copy is up to date first:
```bash
git -C <repo_path> pull --ff-only
cd ~/state-hub && make fix-consistency REPO=repo-seed
```
For repos where implementation runs on a remote machine (e.g. CoulombCore),
use the combined target which pulls before fixing:
```bash
cd ~/state-hub && make fix-consistency-remote REPO=repo-seed
```
**C-15** (DB task ahead of file) is normal in multi-machine workflows — writeback
will sync the file to match DB. **C-16** (repo behind remote) blocks all writes
until you pull — intentional to prevent clobbering remote progress.

View File

@@ -1,27 +1,36 @@
## Stack
- **Language:** Markdown-first registry and planning repo (no application runtime yet)
- **Key deps:** State Hub ADR-001 workplans, `registry/indexes/capabilities.yaml`
Current repo state: Markdown/specification-first planning repo. Implementation workplans target the following stack once source code is added:
- Python 3.12
- FastAPI, Pydantic v2
- SQLAlchemy async, Alembic, asyncpg, Postgres
- httpx for service clients
- pytest for unit, API, contract, and migration tests
- OpenAPI and JSON Schema for public contracts
- whynot-design aligned UI components/adapters where operator UI is needed
## Dev Commands
```bash
# Orient (offline-safe)
# Orient
cat .custodian-brief.md
cat README.md
cat INTENT.md
cat SCOPE.md
ls workplans/
# Consumer bootstrap docs
cat docs/statehub-register.md
cat docs/template-validation-checklist.md
# Review core docs
cat docs/specs/README.md
cat docs/research/2026-06-27-core-hub-lineage-and-platform-reset.md
# After workplan or registry edits from ~/state-hub
make fix-consistency REPO=repo-seed
# After workplan edits, from ~/state-hub
make fix-consistency REPO=core-hub
# Validate registry entries (from reuse-surface checkout)
reuse-surface validate --root .
# Sanity-check markdown / registry edits
# Sanity-check markdown/registry edits
git diff --check
# Registry validation, from a checkout with reuse-surface CLI available
reuse-surface validate --root .
```
Add concrete `install`, `test`, `lint`, `build`, and `run` commands in this file when the FastAPI implementation lands.