Commit graph

69 commits

Author SHA1 Message Date
00a10d165d chore: refresh WORK-RECORDS after LLM-WP-0008 finish
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
2026-08-03 23:50:32 +02:00
custodian-sync
3cecbc9e3e chore(consistency): sync task status from DB [auto]
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Updated by fix-consistency on 2026-08-03:
  - update .custodian-brief.md for llm-connect
2026-08-03 23:50:25 +02:00
ed7c632155 Implement LLM-WP-0008: provider-scoped account balance CLI
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Add pluggable balance registry, OpenRouter credits/key limit client,
and llm-connect balance with one-shot --provider that does not change
library defaults.
2026-08-03 23:49:01 +02:00
c0d5c4ad08 chore: hub IDs for LLM-WP-0008 and WORK-RECORDS index
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
2026-08-03 22:09:35 +02:00
custodian-sync
f0f3a68ed2 chore(consistency): sync task status from DB [auto]
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Updated by fix-consistency on 2026-08-03:
  - update .custodian-brief.md for llm-connect
2026-08-03 22:09:27 +02:00
8159efff8e Add LLM-WP-0008: provider-scoped account balance CLI
Some checks failed
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Has been cancelled
Workplan for backend-pluggable prepaid/budget lookup with one-shot
--provider selection that does not change library defaults.
2026-08-03 22:09:03 +02:00
ce38c6247f chore: refresh WORK-RECORDS after LLM-WP-0007 finish
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
2026-08-03 22:01:15 +02:00
custodian-sync
099beba4e4 chore(consistency): sync task status from DB [auto]
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Updated by fix-consistency on 2026-08-03:
  - update .custodian-brief.md for llm-connect
2026-08-03 22:01:08 +02:00
09aa1f3604 Implement LLM-WP-0007: Kimi K3 default and EUR spend reporting
Some checks failed
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Has been cancelled
Add moonshotai/kimi-k3 as OpenRouter basemodel default after live smoke,
USD→EUR cost conversion, append-only usage ledger, and CLI run/cost/spend
week commands with token and euro reporting.
2026-08-03 22:00:34 +02:00
f3121c3f1f chore: hub IDs for LLM-WP-0007 and WORK-RECORDS index
Write back state_hub task/workstream IDs from fix-consistency and add
the generated WORK-RECORDS.md index.
2026-08-03 21:53:02 +02:00
custodian-sync
79c7969705 chore(consistency): sync task status from DB [auto]
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Updated by fix-consistency on 2026-08-03:
  - update .custodian-brief.md for llm-connect
2026-08-03 21:52:45 +02:00
7d4a8a51c2 Add LLM-WP-0007: Kimi K3 default and EUR spend reporting
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Propose workplan for moonshotai/kimi-k3 as OpenRouter basemodel/default,
CLI token+EUR cost reporting, and Mon-based weekly spend views.
2026-08-03 21:52:08 +02:00
ef2231b2cc Adopt Target Revenue Source License V1C1 (org-wide preliminary rollout)
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Maintainer decision, 2026-07-29: adopts TRSL V1C1 as this repo's
preliminary governing license, per target-revenue's
workplans/TREV-WP-0008-governance-and-pilot-rollout.md T05. Full
specialist legal review is deferred until out of beta (target-revenue
SCOPE.md §1). No Phase is yet declared for this repo.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 00:28:57 +02:00
3073e44600 docs: workplan-first agent guidance prose (CUST-WP-0055 T04 batch 4)
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 3s
2026-07-08 17:22:26 +02:00
c81ff3cb51 Document railiance01-only target for activity-core llm-connect overlay
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 3s
Note coulombcore legacy deployment removed 2026-07-08 after production
cutover to railiance01 (ACTIVITY-WP-0010).
2026-07-08 16:01:13 +02:00
0068e75ccc Regenerate agent instructions from state-hub templates (CUST-WP-0055 T01)
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Sync AGENTS.md, CLAUDE.md, and .claude/rules from updated project_rules
templates: workplan-first session protocol, legacy terminology footnote,
and GET /workplans/ examples.
2026-07-08 14:50:30 +02:00
8fbf74fba0 Add Forgejo CI smoke workflow (enablement template)
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 2s
2026-07-08 12:34:07 +02:00
c5721e4f87 Add Makefile with start target for HTTP serve mode
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)
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]
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)
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)
- 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)
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)
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
c0c9a3da1d docs: record railiance01 llm-connect smoke evidence
Document the 2026-06-19 deployment and in-namespace fixture smoke on
railiance01, where activity-core runs. Clarify that the stable Service URL
is cluster-local and point scheduled triage evidence to ACTIVITY-WP-0010.
2026-06-19 15:58:04 +02:00
92e55fde57 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-06-19:
  - update .custodian-brief.md for llm-connect
2026-06-19 13:51:26 +02:00
90eb39c247 Complete activity-core LLM endpoint handoff (LLM-WP-0006)
Switch the custodian triage default from anthropic/claude-sonnet-4 to
google/gemini-2.5-flash, which advertises structured-output support on
OpenRouter. Tighten the OpenRouter adapter to send strict JSON schema
requests and set provider.require_parameters=true so routing only hits
providers that honor the requested response_format.

Update Kubernetes deploy docs and config for the verified coulombcore
handoff: Containerfile build path, image-pull-policy=Never for smoke
pods, credential-routing notes, and live smoke evidence. Mark
LLM-WP-0006 finished with closure notes from 2026-06-18.
2026-06-19 13:51:12 +02:00
6a0319ee86 Add credential routing instructions for all agent runtimes 2026-06-18 22:48:46 +02:00
f60a2562bb chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-06-17:
  - update .custodian-brief.md for llm-connect
2026-06-17 07:26:42 +02:00
aa0335dba4 Add capability registry scaffold (REUSE-WP-0014-T05 B03) 2026-06-16 01:54:06 +02:00
14ba47c129 Add activity-core LLM endpoint support 2026-06-07 19:24:45 +02:00
1d9fc107ed chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-06-07:
  - update .custodian-brief.md for llm-connect
2026-06-07 16:22:30 +02:00
9204aafb38 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-06-07:
  - update .custodian-brief.md for llm-connect
2026-06-07 13:46:41 +02:00
1edc02de7c chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-06-07:
  - update .custodian-brief.md for llm-connect
2026-06-07 11:46:51 +02:00
24f4c09d42 Implement llm-connect ADHOC diagnostics 2026-06-03 11:56:21 +02:00
79c899b694 Capture llm-connect lessons from CUST-WP-0045 canary as ADHOC-2026-06-02
The 2026-06-02 daily-triage canary debugging session uncovered five real
bugs (commits 9de0f49, 435da49, cd4551c, 583ab57, 1b01f0e), mostly because
llm-connect has no way to see what payload the adapter sent or what the
provider returned. Capture the six structural improvements that would
collapse the next diagnosis of this shape from half a day to minutes:

  T01 — LLM_CONNECT_DEBUG envelope mode for /execute responses
  T02 — ThreadingHTTPServer drop-in replacement for stdlib HTTPServer
  T03 — Per-call audit log + replay CLI (LLM_CONNECT_AUDIT_DIR)
  T04 — Apply param-translation contract to OpenAI and Gemini adapters
  T05 — Provider-agnostic structured-output smoke test in CI
  T06 — Document the model_params translation contract for adapter authors

All six registered in the State Hub under workstream
adhoc-llmc-2026-06-02 (1c936c91-79c7-427d-ab37-9052e8a61cda).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-02 15:55:42 +02:00
1b01f0edf4 Honour explicit OpenRouter --model when it equals the adapter default
The adapter compared self._model to _DEFAULT_MODEL ("anthropic/claude-sonnet-4")
to decide whether to honour the constructor's model. When a caller passes
that exact value via --model, the comparison treats it as "not specified"
and falls through to RunConfig.model_name, which defaults to "gpt-4". So
every llm-connect call started with --provider openrouter --model
anthropic/claude-sonnet-4 actually landed on OpenAI's gpt-4 — and on
gpt-4 OpenAI's structured-output response_format requires a model with
schema support that gpt-4 lacks, returning 400. The CUST-WP-0045 canary
hit this for hours; the smoke probes that worked were the ones with no
json_schema, where gpt-4 returned fine.

Track _explicit_model separately so a constructor or LLMConfig that
matches the default is still treated as a real intent.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-02 14:50:37 +02:00
583ab57a59 Set response_format json_schema strict=False in OpenRouter adapter
The previous strict=True default rejected the activity-core daily-triage
schema (and most real-world application schemas) because OpenAI strict
mode requires additionalProperties:false on every object and every
property in the required list. Application-supplied schemas typically
do not meet that bar — adding additionalProperties recursively at the
adapter would be surprising and may break callers that rely on extra
fields. Flipping strict to False keeps the schema as a soft constraint;
the model still produces structured output and the activity-core
canary's 400 from OpenRouter goes away.

Callers who need strict enforcement can pass response_format directly
via model_params, where the adapter's pass-through handling preserves
the strict flag they set.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-02 14:18:33 +02:00
cd4551c575 Translate json_schema and drop non-OpenAI fields in OpenRouter adapter
The adapter previously did a blind payload.update(config.model_params).
For callers like activity-core that pass reasoning_effort, max_depth,
and json_schema (Claude / llm-connect-specific fields), those leaked
into the OpenAI Chat Completions request body and OpenRouter rejected
the whole call with HTTP 400. CUST-WP-0045 canary on 2026-06-02 hit
this — manual repro confirmed: same prompt with no model_params returns
a clean 10-recommendation WSJF report in 4.5s; with model_params
included, every call 400s.

Replace the merge with a whitelist + translation step:

- pass-through known OpenAI Chat Completions fields (top_p, stop, seed,
  tools, response_format, etc.)
- translate json_schema into the proper response_format wrapper
  ({type:"json_schema", json_schema:{name,schema,strict}})
- drop documented non-OpenAI fields (reasoning_effort, max_depth) so
  the payload stays valid
- silently drop unknown keys rather than risk another 400

The same pattern will need to apply to the OpenAI and Gemini adapters
when their callers start passing provider-specific keys — left as
follow-up rather than speculative refactoring.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-02 14:15:24 +02:00
435da49263 Prefer JSON-bearing envelope fields, skip metadata, in Claude CLI unwrap
The first CUST-WP-0045 canary retry after 9de0f49 still failed schema
validation with `Expecting value: line 1 column 1 (char 0)`. The original
allowlist returned envelope.result verbatim, which on longer prompts
carries the model's conversational preamble ("Triage report generated
and returned via structured output. Key signals: ..."), not the
schema-enforced JSON. The actual structured payload lives in a different
envelope field whose name varies across CLI versions.

Make the unwrap order-aware:
  1. Scan envelope fields and return the first one whose value parses as
     JSON (dict, list, or a string that loads cleanly). Skip well-known
     metadata keys (type, usage, total_cost_usd, etc.) so telemetry can
     never be mistaken for the model payload.
  2. Fall back to the original text-field allowlist only when no field
     carries JSON, so non-schema callers via this same code path still
     see the model's prose.
  3. Surface the raw envelope as last resort.

This is robust against unknown envelope shapes — as long as the schema-
enforced JSON appears somewhere in a non-metadata field, the adapter
will find it.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-02 12:44:25 +02:00
9de0f495db Pass --output-format json with --json-schema and unwrap CLI envelope
The Claude Code adapter previously passed --json-schema alone. On Claude
CLI 2.1.160 that combination still emits the model's conversational
preamble on stdout while the schema-enforced structured payload ships on
a sidecar channel the adapter cannot read. Result: callers requesting
structured output got prose that fails JSON parsing downstream — exactly
the failure mode the activity-core CUST-WP-0045 daily triage canary hit
on 2026-06-01 ("Triage report generated and returned via structured
output. Key signals:..." → json.loads error at column 1).

Fix: when --json-schema is set, also pass --output-format json. The CLI
then writes a JSON envelope on stdout. The adapter unwraps it by
probing a small allowlist of known text-bearing fields (result,
result_text, content, text, output). Unknown envelope shapes fall
through to raw stdout so the operator can introspect the structure and
extend the allowlist.

The unwrap path is only triggered when --json-schema was set, so non-
schema callers keep the existing raw-stdout behavior.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-02 10:20:24 +02:00
b12d1af8bb Support Claude Code JSON schema execution 2026-05-21 03:19:27 +02:00
82e3c07928 Preserve llm-connect run config in server mode 2026-05-19 20:55:02 +02:00
c11c6afa3f Implement-LLM-WP-0005-cost-model-estimators 2026-05-19 05:02:20 +02:00
0054afe689 plan: WP-0005 — cost model and problem-class token estimators
Drafted workplan to move two consumer-side concerns into llm-connect:

- ModelRateRegistry: per-model USD-per-1k rates with provenance, a
  property of the base model, not the application.
- ProblemClass token estimators: generic shapes (chunk-summarization,
  entity-extraction, relation-extraction, judge-eval, report-synthesis)
  with base dimensions + tunable params; consumer supplies the shape
  of its problem and gets a TokenEstimate before any call.

Demand signal: the 2026-05-18 infospace-bench Lefevre Chapter-I smoke
ran 32 calls / 28k tokens / 0.009 USD actual against a planned 8.40
USD — the 1000x variance was entirely consumer-side because there is
no rate table in llm-connect to delegate to.

Three new modules (rates.py, costs.py, problem_classes.py), eight
tasks, registered as workstream 869196c5-551b-4eef-b8d8-cca6f770a9b0
under the custodian topic. A follow-on consumer workplan in
infospace-bench will migrate plan_generation_summary to delegate once
T01-T04 land here.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-19 04:30:52 +02:00
4b685e849c Refresh agent instruction files 2026-05-18 16:55:44 +02:00
a27945101c Adaptive routing initial version 2026-05-18 11:38:12 +02:00
14838ae968 chore(consistency): sync task status from DB [auto]
Updated by fix-consistency on 2026-05-17:
  - update .custodian-brief.md for llm-connect
2026-05-17 22:54:25 +02:00
c4ad4bb9f2 Add adaptive cost-quality routing primitives 2026-05-17 21:32:27 +02:00