Complete fin-hub repo integration (FIN-WP-0000)

Link the DB-first onboarding workstream to FIN-WP-0000-repo-integration.md,
finish agent orientation (rules stubs, remove first-session), add repo
classification, and close all four custodian onboarding tasks.
This commit is contained in:
tegwick 2026-07-08 22:39:22 +02:00
parent a0341ba35f
commit 7e53c21feb
10 changed files with 145 additions and 94 deletions

View file

@ -1,8 +1,29 @@
## Architecture
<!-- TODO: Describe the key design decisions and component structure.
Key modules, data flows, external integrations, state machines, etc. -->
Fin-hub extends `hub-core` with financial models and operator surfaces. Generic
hub primitives (domains, repos, messages, progress) come from hub-core;
fin-specific models and services live here.
### Modules
| Module | Role |
|--------|------|
| `models/` | Budget, commitment, service cost, burn rate dataclasses |
| `ingest/` | CSV parsers for cloud, Anthropic billing, HostEurope invoices |
| `services/runway.py` | Runway projection from balance + monthly burn series |
| `services/alerts.py` | Threshold evaluation (runway months, budget overrun) |
| `coupling/` | FOS §9 signals: fin→dev (resource pressure), fin→ops (cost attribution), fin→canon (viability) |
| `cli.py` | Operator CLI (`finhub` entrypoint) |
### Data flow
```
CSV exports → ingest parsers → cost models → runway/alerts → coupling emit → State Hub progress
```
v0.1 is manual CSV import only. Persistent ledger and HTTP read surface are
tracked in `FIN-WP-0001`.
## Quick Reference
`~/state-hub/mcp_server/TOOLS.md` — MCP tool reference
`~/state-hub/mcp_server/TOOLS.md` — MCP tool reference

View file

@ -1,42 +0,0 @@
## First Session Protocol
Triggered when `get_domain_summary("infotech")` shows **no workplans**.
The project is registered but work has not yet been structured.
**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 2 — Survey in-progress work**
Look for TODOs, open branches, half-finished files. Note done vs. started but incomplete.
**Step 3 — Propose workplans to Bernd**
Propose 13 workplans — each a coherent strand, weeks to months, anchored to a
roadmap phase. **Wait for approval before creating.**
**Step 4 — Write the workplan file; fix-consistency registers it (ADR-001)**
```
workplans/FIN-WP-NNNN-<slug>.md ← write this, commit it
```
Then register by running the consistency check — do **not** call
`create_workplan`/`create_task` yourself; manual registration duplicates what
C-06 creates from the file:
```bash
statehub fix-consistency --repo fin-hub
```
C-06 creates the hub workplan + tasks and writes `state_hub_workstream_id`
(legacy frontmatter name — holds the workplan UUID) and `state_hub_task_id`
back into the file.
**Step 5 — Record the setup**
```
add_progress_event(
summary="First session: structured infotech into N workplans, M tasks",
event_type="milestone",
topic_id="cee7bedf-2b48-46ef-8601-006474f2ad7a",
detail={"workplans": [...], "tasks_created": M}
)
```
<!-- Delete or archive this file once past first session -->

View file

@ -2,7 +2,9 @@
This repo owns **fin-hub** only. It does not own:
<!-- TODO: List what belongs in adjacent repos, e.g.:
- SSH key management → railiance-infra/
- State hub code → state-hub/
-->
- State Hub API / MCP server → `state-hub/`
- Generic hub router factories and models → `hub-core/`
- Payment execution, invoicing, banking → out of scope (see `SCOPE.md`)
- Business canon and bootstrap protocol → `the-custodian/canon/`
- Core Hub ops evidence lane → `core-hub/`
- SSH tunnel lifecycle → `ops-bridge/`

View file

@ -1,5 +1,5 @@
**Purpose:** fin-hub - (fill in purpose)
**Purpose:** Financial Allocator hub for the FOS federation — budgets, burn rate, runway projection, and cross-hub viability signals.
**Domain:** infotech
**Repo slug:** fin-hub
**Topic ID:** cee7bedf-2b48-46ef-8601-006474f2ad7a
**Topic ID:** cee7bedf-2b48-46ef-8601-006474f2ad7a

View file

@ -1,19 +1,26 @@
## Stack
<!-- TODO: Fill in language, frameworks, and key dependencies -->
- **Language:**
- **Key deps:**
- **Language:** Python 3.12+
- **Package manager:** uv
- **Key deps:** hub-core (generic hub primitives), pydantic, httpx
## Dev Commands
```bash
# TODO: Fill in the standard commands for this repo
# Install dependencies
uv sync
# Run tests
uv run pytest
# Lint / type check
# CLI — runway projection
uv run finhub runway --balance 12000 --monthly-burn 2100,2200,2000
# Build / package (if applicable)
```
# CLI — import cost CSVs
uv run finhub import-cloud tests/fixtures/cloud-costs.csv
uv run finhub import-anthropic tests/fixtures/anthropic-billing.csv
uv run finhub import-hosteurope tests/fixtures/hosteurope.csv
# CLI — emit cross-hub signals (requires STATE_HUB_API)
uv run finhub runway --balance 12000 --monthly-burn 2100 --emit
```