Compare commits

...

8 Commits

Author SHA1 Message Date
c5721e4f87 Add Makefile with start target for HTTP serve mode
Some checks failed
CI / test (3.12) (push) Has been cancelled
CI / test (3.10) (push) Has been cancelled
CI / test (3.11) (push) Has been cancelled
Provides `make start` to run the llm-connect server via uv, with optional
LLM_CONNECT_* overrides and standard dev targets for install, test, lint,
and typecheck.
2026-07-07 19:59:35 +02:00
3ea9366c5a Draft capability entry (reuse-surface REUSE-WP-0017-T04, cohort 2)
Some checks failed
CI / test (3.10) (push) Has been cancelled
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
Honest first-pass maturity vector grounded in README/docs/tests present
in this repo; no invented evidence. Flagged for human review before
publish. See reuse-surface history/2026-07-06-coverage-classification.md.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-06 19:41:37 +02:00
5b50b1ada5 chore(consistency): sync task status from DB [auto]
Some checks failed
CI / test (3.10) (push) Has been cancelled
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
Updated by fix-consistency on 2026-07-03:
  - update .custodian-brief.md for llm-connect
2026-07-03 18:47:25 +02:00
dfd2ce7754 activity-core: ExternalSecret for llm-connect-provider-secrets via openbao-activity-core CSS (CCR-2026-0003)
Some checks failed
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
CI / test (3.10) (push) Has been cancelled
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 12:56:21 +02:00
2ff9263f9c Normalize agent instructions and workplan frontmatter (STATE-WP-0067)
Some checks failed
CI / test (3.10) (push) Has been cancelled
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
- Align agent files with on-disk workplan prefixes (infer from workplan ids)
- Set workplan domain to registered domain_slug; add topic_slug where applicable
- Repair frontmatter delimiter formatting; migrate legacy task status literals
- Regenerate AGENTS.md, CLAUDE.md, and .claude/rules from State Hub templates
2026-06-22 23:16:27 +02:00
3e2cdef9b5 Mark .repo-classification.yaml human-reviewed (CUST-WP-0050 T02)
Some checks failed
CI / test (3.11) (push) Has been cancelled
CI / test (3.10) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 11:40:44 +02:00
7c86051835 Reclassify as tooling (CUST-WP-0050 T02)
Some checks failed
CI / test (3.10) (push) Has been cancelled
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
Apply the new 'tooling' category (reusable internal tooling/infrastructure)
from the Repo Classification Standard. First-pass agent classification.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 03:06:02 +02:00
de7be61f0a Add repo classification (CUST-WP-0050 T02)
First-pass agent classification per the Repo Classification Standard v1.0
(canon-repo-classification); pending human review.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 02:44:47 +02:00
18 changed files with 281 additions and 39 deletions

View File

@@ -1,11 +1,11 @@
## First Session Protocol
Triggered when `get_domain_summary("custodian")` shows **no workstreams**.
Triggered when `get_domain_summary("agents")` shows **no workstreams**.
The project is registered but work has not yet been structured.
**Step 1 — Read, don't write**
- `~/the-custodian/canon/projects/custodian/project_charter_v0.1.md` — purpose, scope
- `~/the-custodian/canon/projects/custodian/roadmap_v0.1.md` — planned phases
- `~/the-custodian/canon/projects/agents/project_charter_v0.1.md` — purpose, scope
- `~/the-custodian/canon/projects/agents/roadmap_v0.1.md` — planned phases
- Scan repo root: README, directory structure, existing code or docs
**Step 2 — Survey in-progress work**
@@ -17,20 +17,20 @@ roadmap phase. **Wait for approval before creating.**
**Step 4 — Create workplan file first, then DB record (ADR-001)**
```
workplans/llm-connect-WP-NNNN-<slug>.md ← write this first
workplans/LLM-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_workstream(topic_id="64418556-3206-457a-ba29-6884b5b12cf3", title="...", owner="...", description="...")
create_task(workstream_id="<id>", title="...", priority="high|medium|low")
```
**Step 5 — Record the setup**
```
add_progress_event(
summary="First session: structured custodian into N workstreams, M tasks",
summary="First session: structured agents into N workstreams, M tasks",
event_type="milestone",
topic_id="cee7bedf-2b48-46ef-8601-006474f2ad7a",
topic_id="64418556-3206-457a-ba29-6884b5b12cf3",
detail={"workstreams": [...], "tasks_created": M}
)
```

View File

@@ -1,5 +1,5 @@
**Purpose:** Multi-provider LLM client library — unified adapter interface for OpenAI, Claude, Gemini, OpenRouter with embedding support, token estimation, and TOML-based config.
**Domain:** custodian
**Domain:** agents
**Repo slug:** llm-connect
**Topic ID:** cee7bedf-2b48-46ef-8601-006474f2ad7a
**Topic ID:** 64418556-3206-457a-ba29-6884b5b12cf3

View File

@@ -1,6 +1,7 @@
## Session Protocol
State Hub: http://127.0.0.1:8000
Dev Hub (State Hub API): http://127.0.0.1:8000
MCP server name in `~/.claude.json`: `dev-hub`
**Step 1 — Orient**
@@ -10,7 +11,7 @@ cat .custodian-brief.md
```
Then call the MCP tool for richer cross-domain context when MCP tools are exposed:
```
get_domain_summary("custodian")
get_domain_summary("agents")
```
If MCP tools are unavailable in the current agent session, use the REST API:
```bash
@@ -39,11 +40,11 @@ curl -s -X PATCH "http://127.0.0.1:8000/messages/<id>/read" \
ls workplans/
```
For each file with `status: ready`, `active`, or `blocked`, note pending
`todo`/`in_progress` tasks.
`wait`/`todo`/`progress` tasks.
**Step 4 — Present brief**
1. **Active workstreams** for `custodian` — title, task counts, blocking decisions
1. **Active workstreams** for `agents` — title, task counts, blocking decisions
2. **Pending tasks** from `workplans/` + any `[repo:llm-connect]` hub tasks
3. **Goal guidance** — if `goal_guidance` in summary:
- `needs_workplan`: surface as top action — *"Repo goal '{title}' has no workplan yet"*
@@ -61,13 +62,13 @@ If no workstreams: follow First Session Protocol (`first-session.md`).
**Session close:**
With MCP tools:
```
add_progress_event(summary="...", topic_id="cee7bedf-2b48-46ef-8601-006474f2ad7a", workstream_id="<uuid>")
add_progress_event(summary="...", topic_id="64418556-3206-457a-ba29-6884b5b12cf3", workstream_id="<uuid>")
```
Without MCP tools:
```bash
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":"64418556-3206-457a-ba29-6884b5b12cf3","workstream_id":"<uuid>","event_type":"note","summary":"what changed","author":"codex"}'
```
If workplan files were modified, ensure the local copy is up to date first:
```bash

View File

@@ -1,7 +1,7 @@
## Workplan Convention (ADR-001)
File location: `workplans/llm-connect-WP-NNNN-<slug>.md`
ID prefix: `LLM-WP`
File location: `workplans/LLM-WP-NNNN-<slug>.md`
ID prefix: `LLM-WP-`
Work items originate as files in this repo **before** being registered in the hub.
@@ -12,7 +12,7 @@ repo state, and `finished` when implementation is complete. `stalled` and
`needs_review` are derived health labels, not stored statuses.
Closed workplans may be moved to `workplans/archived/` with a completion-date
prefix: `YYMMDD-llm-connect-WP-NNNN-<slug>.md`. The frontmatter id remains
prefix: `YYMMDD-LLM-WP-NNNN-<slug>.md`. The frontmatter id remains
unchanged; the prefix is only for quick visual reference.
Small opportunistic tasks discovered during another session use **Ad Hoc Tasks**:
@@ -25,4 +25,16 @@ Ecosystem todos from other agents arrive as `[repo:llm-connect]` hub tasks —
visible at session start. Pick one up by creating the workplan file, then registering
the workstream.
Task blocks use this shape:
```task
id: LLM-WP-NNNN-T01
status: wait | todo | progress | done | cancel
priority: high | medium | low
state_hub_task_id: "<uuid>" # written by fix-consistency — do not edit
```
Status progression is `todo``progress``done`; use `wait` for waiting or
blocked work and `cancel` for stopped work.
<!-- Ralph Loop rules and HEUREKA sequence: ~/.claude/CLAUDE.md — do not duplicate here -->

View File

@@ -1,8 +1,8 @@
<!-- custodian-brief: generated by fix-consistency — do not edit manually -->
# Custodian Brief — llm-connect
**Domain:** custodian
**Last synced:** 2026-06-19 11:51 UTC
**Domain:** infotech
**Last synced:** 2026-07-03 16:47 UTC
**State Hub:** http://127.0.0.1:8000 *(adjust if running on a remote machine)*
## Active Workstreams
@@ -13,6 +13,6 @@
## MCP Orientation (when available)
If the state-hub MCP server is reachable, call:
`get_domain_summary("custodian")`
`get_domain_summary("infotech")`
This provides richer cross-domain context.
If the MCP call fails, use this file as your orientation source.

25
.repo-classification.yaml Normal file
View File

@@ -0,0 +1,25 @@
# Repo classification (Repo Classification Standard v1.0).
repo_classification:
standard: Repo Classification Standard
version: '1.0'
classified_at: '2026-06-22'
classified_by: human
category: tooling
domain: agents
secondary_domains:
- infotech
capability_tags:
- orchestration
- model-routing
- configuration
- automation
business_stake:
- technology
- product
- automation
business_mechanics:
- operation
- adaptation
notes: Multi-provider LLM client library for Python (pluggable adapters / model routing).
Primary domain agents, infotech secondary.

View File

@@ -4,9 +4,9 @@
**Purpose:** Multi-provider LLM client library — unified adapter interface for OpenAI, Claude, Gemini, OpenRouter with embedding support, token estimation, and TOML-based config.
**Domain:** custodian
**Domain:** agents
**Repo slug:** llm-connect
**Topic ID:** `cee7bedf-2b48-46ef-8601-006474f2ad7a`
**Topic ID:** `64418556-3206-457a-ba29-6884b5b12cf3`
**Workplan prefix:** `LLM-WP-`
---
@@ -28,7 +28,7 @@ there is no MCP server for Codex agents.
cat .custodian-brief.md
# Active workstreams for this domain
curl -s "http://127.0.0.1:8000/workstreams/?topic_id=cee7bedf-2b48-46ef-8601-006474f2ad7a&status=active" \
curl -s "http://127.0.0.1:8000/workstreams/?topic_id=64418556-3206-457a-ba29-6884b5b12cf3&status=active" \
| python3 -m json.tool
# Check inbox
@@ -63,8 +63,8 @@ Omit `workstream_id` / `task_id` when not applicable.
```bash
curl -s -X PATCH "http://127.0.0.1:8000/tasks/<task_id>" \
-H "Content-Type: application/json" \
-d '{"status": "in_progress"}'
# values: todo | in_progress | done | blocked
-d '{"status": "progress"}'
# values: wait | todo | progress | done | cancel
```
### Flag a task for human review
@@ -83,7 +83,7 @@ curl -s -X PATCH "http://127.0.0.1:8000/tasks/<task_id>" \
1. `cat .custodian-brief.md` — domain goal and open workstreams (offline-safe)
2. Check inbox: `GET /messages/?to_agent=llm-connect&unread_only=true`; mark read
3. Scan workplans: `ls workplans/` — note `status: ready`, `active`, or `blocked` files and open tasks
4. Check blocked tasks: `GET /tasks/?needs_human=true`
4. Check human-needed tasks: `GET /tasks/?needs_human=true`
**During work:**
- Update task statuses in workplan files as tasks progress
@@ -151,6 +151,11 @@ every repo's agent instructions because it is high-frequency, high-risk, and eas
get wrong.
**Canon:** `~/ops-warden/wiki/CredentialRouting.md` · catalog `~/ops-warden/registry/routing/catalog.yaml`
<!-- REPO-AGENTS-EXTENSIONS -->
<!-- Append repo-specific agent instructions below this marker.
The state-hub template sync preserves content after this line. -->
---
## Workplan Convention (ADR-001)
@@ -176,7 +181,7 @@ anything needing analysis, design, approval, dependencies, or multiple phases.
id: LLM-WP-NNNN
type: workplan
title: "..."
domain: custodian
domain: agents
repo: llm-connect
status: proposed | ready | active | blocked | backlog | finished | archived
owner: codex
@@ -198,7 +203,7 @@ derived health labels, not frontmatter statuses.
` ` `task
id: LLM-WP-NNNN-T01
status: todo | in_progress | done | blocked
status: wait | todo | progress | done | cancel
priority: high | medium | low
state_hub_task_id: "<uuid>" # written by fix-consistency — do not edit
` ` `
@@ -206,7 +211,7 @@ state_hub_task_id: "<uuid>" # written by fix-consistency — do not edit
Task description text.
```
Status progression: `todo` → `in_progress` → `done` (or `blocked`)
Status progression: `todo` → `progress` → `done`; use `wait` for waiting/blocked work and `cancel` for stopped work.
To create a new workplan:
1. Write the file following the format above

37
Makefile Normal file
View File

@@ -0,0 +1,37 @@
-include .env
export
.PHONY: install test lint typecheck start help
UV ?= $(shell command -v uv 2>/dev/null || if [ -x "$$HOME/.local/bin/uv" ]; then printf "%s" "$$HOME/.local/bin/uv"; else printf "%s" "uv"; fi)
LLM_CONNECT_HOST ?= 127.0.0.1
LLM_CONNECT_PORT ?= 8080
LLM_CONNECT_PROVIDER ?= mock
LLM_CONNECT_MODEL ?=
SERVER_ARGS ?=
install: ## Install dependencies (dev group)
$(UV) sync --group dev
test: ## Run test suite
$(UV) run pytest
lint: ## Run ruff linter
$(UV) run ruff check .
typecheck: ## Run mypy type checker
$(UV) run mypy llm_connect
start: ## Start llm-connect HTTP server (reads .env and LLM_CONNECT_* overrides)
$(UV) run python -m llm_connect.server \
--host $(LLM_CONNECT_HOST) \
--port $(LLM_CONNECT_PORT) \
--provider $(LLM_CONNECT_PROVIDER) \
$(if $(LLM_CONNECT_MODEL),--model $(LLM_CONNECT_MODEL),) \
$(SERVER_ARGS)
help: ## Show this help message
@grep -Eh '^[a-zA-Z_-]+:.*?##' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-16s\033[0m %s\n", $$1, $$2}' | \
sort

View File

@@ -0,0 +1,21 @@
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
name: llm-connect-provider-secrets
namespace: activity-core
labels:
app.kubernetes.io/name: llm-connect
app.kubernetes.io/part-of: railiance-gitops
spec:
refreshInterval: 1h
secretStoreRef:
kind: ClusterSecretStore
name: openbao-activity-core
target:
name: llm-connect-provider-secrets
creationPolicy: Owner
data:
- secretKey: OPENROUTER_API_KEY
remoteRef:
key: platform/workloads/activity-core/llm-connect/llm-connect-provider-secrets
property: OPENROUTER_API_KEY

View File

@@ -5,3 +5,4 @@ resources:
- deployment.yaml
- service.yaml
- networkpolicy.yaml
- externalsecret.yaml

View File

@@ -0,0 +1,123 @@
---
id: capability.agents.llm-connector
name: Pluggable LLM Adapter Library (llm-connect)
summary: Provider-neutral Python/CLI LLM adapter library supporting OpenRouter, Gemini, OpenAI, and the
Claude Code CLI out of the box, with a clean abstract interface for adding new providers.
owner: llm-connect
status: draft
domain: agents
tags:
- llm
- adapter
- provider-neutral
maturity:
discovery:
current: D3
target: D5
confidence: medium
rationale: README documents a working quick-start (`create_adapter`, `RunConfig`, `execute_prompt`),
the supported provider list, and both local-editable and future-published install paths.
availability:
current: A2
target: A3
confidence: medium
rationale: Installable today via `pip install -e` (local) with a documented future `pip install llm-connect`
path once published; consumed today by sibling repos including `cya` (can-you-assist) and referenced
as the intended backend for reuse-surface's own `establish --discover`.
external_evidence:
completeness:
level: C2
confidence: low
basis: scope_vs_intent_and_consumer_expectations
satisfied_expectations:
- four providers implemented (OpenRouter, Gemini, OpenAI, Claude Code CLI)
- abstract adapter interface for adding new providers
- already a named integration point for other repos (can-you-assist's LLMAdapter seam, reuse-surface's
establish --discover)
broken_expectations: []
out_of_scope_expectations: []
reliability:
level: R1
confidence: low
basis: consumer_quality_signals
known_reliability_risks:
- no llm-connect instance was running on this workstation during the REUSE-WP-0017 sweep, so establish
--discover fell back to manual authoring for this campaign
discovery:
intent: Give Python and CLI consumers a single, provider-neutral way to call LLMs, decoupling agent/tool
code from any one vendor's SDK.
includes:
- provider-neutral adapter interface
- OpenRouter, Gemini, OpenAI, Claude Code CLI adapters
- RunConfig-based execution
excludes:
- hosting or credential custody for providers (routes to OpenBao/operator paths per credential-routing
conventions)
assumptions: []
use_cases: []
research_memos: []
availability:
current_level: A2
target_level: A3
current_artifacts:
- Python package (`llm_connect`)
target_artifacts: []
consumption_modes:
- library import
- cli
relations:
depends_on: []
supports: []
related_to: []
evidence:
documentation:
- README.md
tests:
- tests/
consumer_feedback: []
bug_reports: []
incidents: []
consumer_guidance:
recommended_for:
- any repo needing provider-neutral LLM calls instead of a vendor-specific SDK
not_recommended_for:
- needs requiring a provider not yet adapted (extend via the abstract interface first)
known_limitations:
- not yet published to a package index; local editable install only
promotion_history: []
---
# Pluggable LLM Adapter Library (llm-connect)
## Overview
`llm-connect` provides pluggable, provider-neutral LLM adapters for Python and the command line, supporting OpenRouter, Gemini, OpenAI, and the Claude Code CLI out of the box behind a clean abstract interface, and is already the intended backend for several sibling repos including `can-you-assist` and `reuse-surface`'s own drafting tooling.
## Assessment notes
### Discovery
README documents a working quick-start (`create_adapter`, `RunConfig`, `execute_prompt`), the supported provider list, and both local-editable and future-published install paths.
### Availability
Installable today via `pip install -e` (local) with a documented future `pip install llm-connect` path once published; consumed today by sibling repos including `cya` (can-you-assist) and referenced as the intended backend for reuse-surface's own `establish --discover`.
### Completeness
First-pass honest assessment from the REUSE-WP-0017 coverage campaign
(reuse-surface). No external consumer feedback exists yet; levels reflect
scope-vs-intent documentation quality, not internal code quality.
### Reliability
No production consumer telemetry exists yet; reliability level is
intentionally conservative pending REUSE-WP-0019 reuse-telemetry evidence.
## Promotion checklist
- [x] ID follows `capability.<domain>.<name>` pattern
- [x] Maturity enums match `specs/CapabilityMaturityStandard.md`
- [x] `external_evidence` is populated separately from `maturity`
- [ ] Relations reference valid capability IDs (none yet)
- [x] Index entry added in `registry/indexes/capabilities.yaml`

View File

@@ -1,4 +1,20 @@
version: 1
updated: '2026-06-16'
updated: '2026-07-06'
domain: helix_forge
capabilities: []
capabilities:
- id: capability.agents.llm-connector
name: Pluggable LLM Adapter Library (llm-connect)
summary: Provider-neutral Python/CLI LLM adapter library supporting OpenRouter, Gemini, OpenAI, and
the Claude Code CLI out of the box, with a clean abstract interface for adding new providers.
vector: D3 / A2 / C2 / R1
domain: agents
status: draft
owner: llm-connect
path: registry/capabilities/capability.agents.llm-connector.md
tags:
- llm
- adapter
- provider-neutral
consumption_modes:
- library import
- cli

View File

@@ -2,7 +2,7 @@
id: LLM-WP-0006
type: workplan
title: "Activity-Core Always-On LLM Endpoint"
domain: custodian
domain: agents
repo: llm-connect
status: finished
owner: codex

View File

@@ -2,7 +2,7 @@
id: LLM-WP-0001
type: workplan
title: llm-connect — Foundation & GAAF Baseline
domain: custodian
domain: agents
status: completed
owner: llm-connect
created: 2026-04-01

View File

@@ -2,7 +2,7 @@
id: LLM-WP-0002
type: workplan
title: llm-connect — Core Extensions (FR-4 BudgetTracker + FR-3 async)
domain: custodian
domain: agents
status: completed
owner: llm-connect
created: 2026-04-01

View File

@@ -2,7 +2,7 @@
id: LLM-WP-0003
type: workplan
title: llm-connect — Functional Extensions (FR-2 RoutingPolicy + FR-1 HTTP server)
domain: custodian
domain: agents
status: completed
owner: llm-connect
created: 2026-04-01

View File

@@ -2,7 +2,7 @@
id: LLM-WP-0004
type: workplan
title: Adaptive Cost-Quality Routing
domain: custodian
domain: agents
status: completed
owner: llm-connect
created: 2026-05-17
@@ -264,7 +264,8 @@ state_hub_task_id: "3a073ff7-0170-4a95-9c2a-a5daa84964e6"
### T01 — Quality observation data model + ledger
| ID | Title | Priority | Status |
|-----|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|--------|
|-----|------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------|----------|--------|
| T01 | `QualityObservation` dataclass: `task_type`, `adapter_id`, `model_id`, `cost_usd`, `quality_score` (0..1), `latency_ms`, `tokens_in`, `tokens_out`, `baseline_adapter_id`, `recorded_at`, `tags` | high | done |
| T02 | `QualityLedger` append-only JSONL store with file-locked writes, configurable path, simple query helpers (`by_task_type`, `recent`, `mean_quality`) | high | done |
| T03 | TTL helpers: `prune_before(timestamp)` and `is_stale(observation, max_age)` so callers can refresh observations without re-reading the whole ledger | medium | done |

View File

@@ -2,7 +2,7 @@
id: LLM-WP-0005
type: workplan
title: "Cost Model and Problem-Class Token Estimators"
domain: custodian
domain: agents
repo: llm-connect
status: finished
owner: llm-connect