repositories / smith

smith

There are many coding harnesses - but this one is fast

owned by bugabinga

docs(system): auth plan and env config layer

85dfea5cd6ce022a75331c2a8e6e093f06312594

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (2)

+88 / −1 text lines

Diff layout

.system/plans/SMH-PLAN-VOETK_DD-auth-store-and-provider-selection/index.md

Added
new file mode 100644

+83 / −0 text lines

1---
2id: SMH-PLAN-VOETK_DD
3type: plan
4title: "Auth Store and Provider Selection"
5spec: SMH-SPEC-SPEC0001
6status: draft
7depends_on: [SMH-PLAN-AIAG0001]
8---
9
10# Auth Store and Provider Selection
12## Outcome
14Credentials resolve deterministically from explicit flags, the Smith auth store, or environment variables.
15Eval and RPC run against any supported vendor with no implicit provider default.
16Unresolved credentials fail before dispatch with every source tried named.
18## Scope
20Auth data persistence, `smith auth` commands, provider and model selection flags, the shared flag surface, and removal of hard-coded OpenAI defaults.
21Provider plugins, catalogs, aliases, KDL configuration files, and credential refresh beyond existing behavior remain out of scope.
22Requires the SMH-SPEC-SPEC0001 configuration-precedence amendment adding the environment layer.
24## Behaviors
26Ordered by delivery value.
281. **Auth store**: `smith auth add` persists one credential per provider under XDG `smith/auth` as plaintext files with user-only permissions.
292. **Inspection**: `smith auth list` reports providers and credential provenance without printing secrets; `smith auth remove` deletes one entry.
303. **Pre-dispatch check**: `smith auth check` resolves a provider's credential without a model request and prints the winning source.
314. **Flag surface**: each option is declared once with a command-line flag and a `SMITH_`-prefixed environment name; eval and RPC expose `--provider`, `--model`, `--base-url`; the command line wins over the environment, and resolved values report their source.
32Capabilities stay in the catalog; request options such as thinking levels arrive with catalog levels, not as flags.
335. **Resolution order**: flag argument, then auth store, then environment variable; first hit wins, ties across sources resolve by this order.
346. **Explicit failure**: with no provider flag, no stored credential, and no environment variable, commands fail naming the vendor, the missing credential, and every source tried.
357. **Hygiene**: credential plaintext never enters logs, session traces, replay output, or diagnostics.
37## Resolution model
39```mermaid
40flowchart LR
41 F["--provider/--model/--base-url flags"] --> S{"flag set?"}
42 S -- yes --> C["use flag values"]
43 S -- no --> A["auth store lookup"] --> T{"found?"}
44 T -- yes --> C2["use stored credential"]
45 T -- no --> E["environment variable"] --> U{"set?"}
46 U -- yes --> C3["use env credential"]
47 U -- no --> X["fail: name vendor + all sources tried"]
48 C --> D["resolve before dispatch"]
49 C2 --> D
50 C3 --> D
51```
53## Plan dependencies
55```mermaid
56flowchart LR
57 AIAG1["AIAG0001<br/>agent loop, env auth"] --> THIS["VOETK_DD<br/>auth store, selection"]
58 THIS --> PLUG["PLUG0001<br/>provider plugins, catalogs"]
59```
61## Interfaces
63- `smith::config`: XDG auth paths.
64- `smith-ai::auth`: store-backed credential registry; resolution order; provenance.
65- `smith-harness::runtime`: provider assembly from explicit selection; removal of vendor defaults.
66- `smith-cli`: `auth` subcommand group; eval and RPC selection flags.
68## Verification
70- `smith auth add` then `list` then `remove` round-trips one provider entry; file permissions are user-only.
71- `smith auth check` succeeds and fails without any network activity.
72- Resolution picks flag > store > env deterministically for each vendor.
73- Eval without any credential source fails with vendor and all sources named; no OpenAI endpoint or model is implied.
74- Every option resolves from one declaration; the command-line value overrides the environment value.
75- Diagnostics report which surface supplied each resolved option; undeclared environment prefixes are ignored.
76- Each vendor (OpenAI-compatible, Anthropic, Google) completes one eval round using a stored credential.
77- Logs, traces, and replay output contain no credential plaintext.
79## Stop conditions
81- Store format cannot preserve user-only permissions portably.
82- Provider selection cannot resolve a vendor without network access.
83- A diagnostics path would require printing secret material.

.system/specs/SMH-SPEC-SPEC0001-smith-specification/index.md

Modified

+5 / −1 text lines

3393393. plugin contributions,
3403404. user configuration,
3413415. trusted project configuration,
3426. explicit command-line overrides.
3426. environment variables,
3437. explicit command-line overrides.
345Each option is declared once across its command-line and environment surfaces.
346Resolved values report their source.
344348Invalid values fail with their source and field path.
345349Unknown values follow the owning schema's explicit policy.