Skip to content

Commit ab956ca

Browse files
authored
Add Local Model Door CLI surface
Adds non-mutating local-model doctor/profiles/plan/route/evidence commands for SourceOS Local Model Door integration.
1 parent b7982f0 commit ab956ca

4 files changed

Lines changed: 439 additions & 1 deletion

File tree

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ It should contain:
1818
- model-router client utilities;
1919
- guardrail/eval/evidence helpers;
2020
- agent sandbox/run helpers;
21+
- Local Model Door runtime detection and route planning helpers;
2122
- Agent Machine local mount and secure host-interface helpers;
2223
- Office Plane dry-run, guarded execution, inspection, and evidence helpers;
2324
- fingerprint and proof bundle tools;
@@ -60,6 +61,11 @@ sourceosctl [--version] <command> [<subcommand>] [options]
6061
| `sourceosctl fingerprint collect --dry-run` | Print environment fingerprint fields (dry-run only) |
6162
| `sourceosctl ai labs list` | List available AI labs (read-only) |
6263
| `sourceosctl agents sandbox plan --dry-run` | Print agent sandbox plan (dry-run only) |
64+
| `sourceosctl local-model doctor` | Inspect local model runtime and installed models without pulling weights or inference |
65+
| `sourceosctl local-model profiles` | List SourceOS Local Model Door profile refs |
66+
| `sourceosctl local-model plan --profile local-llama32-1b` | Render local model runtime plan without installing or running models |
67+
| `sourceosctl local-model route --task-class office-assist` | Render hash-only model route decision under local-first policy |
68+
| `sourceosctl local-model evidence inspect <path>` | Inspect local model route evidence JSON |
6369
| `sourceosctl agent-machine mounts plan` | Render Agent Machine local mount plan for dev/docs/downloads roots (dry-run) |
6470
| `sourceosctl agent-machine mounts init --dry-run` | Render mount initialization plan; no directories or mounts are created |
6571
| `sourceosctl agent-machine mounts init --execute --policy-ok` | Create only scoped local output/download directories and emit AgentMachineMountEvidence |
@@ -89,6 +95,10 @@ python3 bin/sourceosctl release inspect-archive fixtures/nlboot_release_valid
8995
python3 bin/sourceosctl fingerprint collect --dry-run
9096
python3 bin/sourceosctl ai labs list
9197
python3 bin/sourceosctl agents sandbox plan --dry-run
98+
python3 bin/sourceosctl local-model doctor
99+
python3 bin/sourceosctl local-model profiles
100+
python3 bin/sourceosctl local-model plan --profile local-llama32-1b
101+
python3 bin/sourceosctl local-model route --task-class office-assist --prompt "local prompt text is hashed only"
92102
python3 bin/sourceosctl agent-machine mounts plan
93103
python3 bin/sourceosctl agent-machine mounts init --dry-run
94104
python3 bin/sourceosctl agent-machine mounts init --execute --policy-ok --evidence-out ./mount-evidence.json
@@ -104,6 +114,24 @@ python3 bin/sourceosctl office convert ./example.docx --to pdf --dry-run
104114
python3 bin/sourceosctl office convert ./example.docx --to pdf --execute --policy-ok --evidence-out ./office-convert-evidence.json
105115
```
106116

117+
### Local Model Door defaults
118+
119+
The Local Model Door aligns with:
120+
121+
- `SourceOS-Linux/sourceos-model-carry` for local model profiles;
122+
- `SocioProphet/model-router` for routing;
123+
- `SocioProphet/model-governance-ledger` for personal tuning contracts;
124+
- `SociOS-Linux/socios` for opt-in personalization orchestration.
125+
126+
Default profiles:
127+
128+
| Profile key | Model | Role |
129+
| --- | --- | --- |
130+
| `local-llama32-1b` | `llama3.2:1b` | laptop-safe router, triage, summarization, rewrite, Office assist |
131+
| `local-llama32-3b` | `llama3.2:3b` | quality local fallback |
132+
133+
The Local Model Door does **not** pull model weights, start Ollama, run inference, send prompts off-device, or authorize tool use. `local-model route --prompt ...` emits only a SHA-256 prompt hash.
134+
107135
### Agent Machine local mount defaults
108136

109137
The first Agent Machine mount slice aligns with the SourceOS contracts in `SourceOS-Linux/sourceos-spec`:
@@ -178,13 +206,15 @@ M1 is repo maturity and install surface definition:
178206
- `SociOS-Linux/nlboot`: boot/recovery client and evidence records.
179207
- `SourceOS-Linux/sourceos-spec`: canonical SourceOS schemas and contracts.
180208
- `SourceOS-Linux/sourceos-boot`: SourceOS boot/recovery integration.
209+
- `SourceOS-Linux/sourceos-model-carry`: local model profiles and carry-layer service refs.
181210
- `SourceOS-Linux/agent-term`: terminal-native SourceOS operator ChatOps console.
182211
- `SociOS-Linux/workstation-contracts`: workstation/CI conformance contracts and IPC receipts.
212+
- `SociOS-Linux/socios`: opt-in automation and personalization orchestration.
183213
- `SocioProphet/prophet-workspace`: workspace product semantics, Professional Workrooms, and OfficeArtifact contracts.
184214
- `SocioProphet/homebrew-prophet`: Homebrew install formulae.
185215
- `SocioProphet/model-router`: governed model/service routing.
186216
- `SocioProphet/guardrail-fabric`: guardrail policy client integration.
187-
- `SocioProphet/model-governance-ledger`: evidence and promotion records.
217+
- `SocioProphet/model-governance-ledger`: evidence, consent, evaluation, promotion, and personalization governance records.
188218
- `SocioProphet/agent-registry`: governed agent identity/tool-grant contracts.
189219
- `SocioProphet/agentplane`: governed execution, placement, run, replay, and evidence.
190220

sourceosctl/cli.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
fingerprint,
1313
ai,
1414
agents,
15+
local_model,
1516
agent_machine,
1617
office,
1718
)
@@ -134,6 +135,84 @@ def build_parser() -> argparse.ArgumentParser:
134135
)
135136
agents_sandbox_plan_p.set_defaults(func=agents.sandbox_plan)
136137

138+
# --- local-model ---
139+
local_model_p = sub.add_parser("local-model", help="Local Model Door helpers")
140+
local_model_sub = local_model_p.add_subparsers(
141+
dest="local_model_command", metavar="<subcommand>"
142+
)
143+
local_model_sub.required = True
144+
145+
local_model_doctor_p = local_model_sub.add_parser(
146+
"doctor", help="Inspect local model runtime availability without pulling or inference"
147+
)
148+
local_model_doctor_p.set_defaults(func=local_model.doctor)
149+
150+
local_model_profiles_p = local_model_sub.add_parser(
151+
"profiles", help="List built-in local model profile references"
152+
)
153+
local_model_profiles_p.set_defaults(func=local_model.profiles)
154+
155+
local_model_plan_p = local_model_sub.add_parser(
156+
"plan", help="Render a local model runtime plan without pulling weights"
157+
)
158+
local_model_plan_p.add_argument(
159+
"--profile",
160+
default="local-llama32-1b",
161+
choices=sorted(local_model.LOCAL_MODEL_PROFILES),
162+
help="Local model profile key",
163+
)
164+
local_model_plan_p.set_defaults(func=local_model.plan)
165+
166+
local_model_route_p = local_model_sub.add_parser(
167+
"route", help="Render a hash-only local model route decision"
168+
)
169+
local_model_route_p.add_argument(
170+
"--task-class",
171+
required=True,
172+
choices=[
173+
"router",
174+
"triage",
175+
"summarization",
176+
"rewrite",
177+
"office-assist",
178+
"agent-machine-assist",
179+
"offline-fallback",
180+
"coding-assist",
181+
"privacy-first-chat",
182+
"complex-reasoning",
183+
],
184+
help="Task class to route",
185+
)
186+
local_model_route_p.add_argument(
187+
"--prompt",
188+
default=None,
189+
help="Optional prompt text; only a SHA-256 hash is emitted",
190+
)
191+
local_model_route_p.add_argument(
192+
"--personalization-ref",
193+
default=None,
194+
help="Optional personal model/adaptation governance reference",
195+
)
196+
local_model_route_p.add_argument(
197+
"--router-binding-ref",
198+
default=local_model.DEFAULT_ROUTER_BINDING_REF,
199+
help="Model-router binding reference",
200+
)
201+
local_model_route_p.set_defaults(func=local_model.route)
202+
203+
local_model_evidence_p = local_model_sub.add_parser(
204+
"evidence", help="Local model evidence helpers"
205+
)
206+
local_model_evidence_sub = local_model_evidence_p.add_subparsers(
207+
dest="local_model_evidence_command", metavar="<subcommand>"
208+
)
209+
local_model_evidence_sub.required = True
210+
local_model_evidence_inspect_p = local_model_evidence_sub.add_parser(
211+
"inspect", help="Inspect local model route evidence JSON"
212+
)
213+
local_model_evidence_inspect_p.add_argument("path", help="Path to local model evidence JSON")
214+
local_model_evidence_inspect_p.set_defaults(func=local_model.evidence_inspect)
215+
137216
# --- agent-machine ---
138217
agent_machine_p = sub.add_parser("agent-machine", help="Agent Machine helpers")
139218
agent_machine_sub = agent_machine_p.add_subparsers(

0 commit comments

Comments
 (0)