Skip to content

Commit 98e52df

Browse files
author
repo-pipeline
committed
Add Print-OS agent surfaces
1 parent d8661ab commit 98e52df

10 files changed

Lines changed: 534 additions & 0 deletions

File tree

.mcp.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"mcpServers": {
3+
"print-os": {
4+
"command": "python3",
5+
"args": ["tools/print_os_mcp.py"]
6+
}
7+
}
8+
}

AGENTS.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,15 @@ Success line: “I noticed X, found a better way. The system just got an upgrade
2424

2525
Full recipe: `docs/agent-law/empower-orchestrator.md`.
2626
<!-- EMPOWER_ORCHESTRATOR:END -->
27+
28+
## Print-OS Agent Surfaces
29+
30+
Before operating the repo, check `llms.txt` and `skills/print-os/SKILL.md`.
31+
32+
Local helpers:
33+
34+
- `python3 tools/print_os_cli.py manifest --format json`
35+
- `python3 tools/print_os_cli.py job-payload --name "Bracket" --material PLA --width 40 --depth 20 --height 12`
36+
- `.mcp.json` -> `tools/print_os_mcp.py`
37+
38+
Creating jobs through the CLI or MCP writes to the local running API. Keep that as an explicit operator action.

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,24 @@ bash scripts/smoke-test.sh
4444

4545
For exact backend, Streamlit, web, 3D-designer, security, and release checks, see the [Operator Runbook](docs/OPERATOR_RUNBOOK.md). Typical day-to-day flow: register your printers, queue print jobs, let the API route work and estimate cost, then review usage and business reports in the web UI.
4646

47+
## Agent surfaces
48+
49+
Print-OS now ships direct agent/operator entrypoints:
50+
51+
- **CLI:** `python3 tools/print_os_cli.py manifest --format json`
52+
- **MCP:** `.mcp.json` registers `tools/print_os_mcp.py` as a local stdio MCP server.
53+
- **Skill:** `skills/print-os/SKILL.md` gives Codex, Claude Code, and other skill-aware agents the safe operating workflow.
54+
55+
Useful CLI examples:
56+
57+
```bash
58+
python3 tools/print_os_cli.py job-payload --name "Bracket" --material PLA --width 40 --depth 20 --height 12
59+
python3 tools/print_os_cli.py api-get health --base-url http://127.0.0.1:8000
60+
python3 tools/print_os_cli.py create-job --name "Bracket" --material PLA --width 40 --depth 20 --height 12
61+
```
62+
63+
The MCP server exposes `print_os_manifest`, `print_os_job_payload`, `print_os_api_get`, and `print_os_create_job`. Read operations are safe; `print_os_create_job` writes to the local running API and should be treated as an explicit operator action.
64+
4765
## Why / how it works
4866

4967
Most maker tooling stops at slicing a single part. Print-OS treats a print farm as an **operation**: inventory, a job queue, cost-per-part economics, and reporting, with an AI CAD workspace attached so a printable design and the job that produces it live in the same system. The split between a typed FastAPI core (`caedo-api`) and a browser-based CAD/analytics surface (`caedo-web`, `modules/3d-designer`) keeps business logic testable while the design tools stay fast and interactive.
@@ -57,6 +75,8 @@ Most maker tooling stops at slicing a single part. Print-OS treats a print farm
5775
## Links
5876

5977
- **AI / agent navigation:** [llms.txt](llms.txt)
78+
- **Agent skill:** [skills/print-os/SKILL.md](skills/print-os/SKILL.md)
79+
- **Local MCP config:** [.mcp.json](.mcp.json)
6080
- **Operator verification:** [docs/OPERATOR_RUNBOOK.md](docs/OPERATOR_RUNBOOK.md)
6181
- **License:** [MIT](LICENSE)
6282
- **KyaniteLabs:** [kyanitelabs.tech](https://kyanitelabs.tech)
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
from __future__ import annotations
2+
3+
import json
4+
import subprocess
5+
import sys
6+
from pathlib import Path
7+
8+
9+
ROOT = Path(__file__).resolve().parents[2]
10+
11+
12+
def run_tool(*args: str) -> subprocess.CompletedProcess[str]:
13+
return subprocess.run(
14+
[sys.executable, *args],
15+
cwd=ROOT,
16+
text=True,
17+
capture_output=True,
18+
check=True,
19+
)
20+
21+
22+
def test_agent_surface_files_exist():
23+
required = [
24+
".mcp.json",
25+
"tools/print_os_cli.py",
26+
"tools/print_os_mcp.py",
27+
"skills/print-os/SKILL.md",
28+
"skills/print-os/agents/openai.yaml",
29+
]
30+
for path in required:
31+
assert (ROOT / path).exists(), path
32+
33+
34+
def test_cli_manifest_and_job_payload_are_valid_json():
35+
manifest = run_tool("tools/print_os_cli.py", "manifest", "--format", "json")
36+
manifest_json = json.loads(manifest.stdout)
37+
assert manifest_json["name"] == "Print-OS"
38+
assert "caedo-api" in manifest_json["components"]
39+
40+
payload = run_tool(
41+
"tools/print_os_cli.py",
42+
"job-payload",
43+
"--name",
44+
"Test Bracket",
45+
"--material",
46+
"PLA",
47+
"--width",
48+
"40",
49+
"--depth",
50+
"20",
51+
"--height",
52+
"12",
53+
)
54+
payload_json = json.loads(payload.stdout)
55+
assert payload_json["status"] == "queued"
56+
assert payload_json["material"] == "PLA"
57+
58+
59+
def test_mcp_self_test_lists_tools():
60+
result = run_tool("tools/print_os_mcp.py", "--self-test")
61+
data = json.loads(result.stdout)
62+
assert "print_os_manifest" in data["tools"]
63+
assert "print_os_create_job" in data["tools"]
64+
65+
66+
def test_mcp_config_names_print_os_server():
67+
config = json.loads((ROOT / ".mcp.json").read_text())
68+
assert "print-os" in config["mcpServers"]

docs/OPERATOR_RUNBOOK.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,20 @@ npm install
3131

3232
## Operator Paths
3333

34+
### Agent Surfaces
35+
36+
From the repo root:
37+
38+
```bash
39+
python3 tools/print_os_cli.py manifest --format json
40+
python3 tools/print_os_cli.py job-payload --name "Bracket" --material PLA --width 40 --depth 20 --height 12
41+
python3 tools/print_os_cli.py api-get health --base-url http://127.0.0.1:8000
42+
```
43+
44+
`.mcp.json` registers `tools/print_os_mcp.py` for MCP-capable agents. The server exposes read tools for the manifest, job payload generation, and local API inspection, plus `print_os_create_job` for explicit local job creation.
45+
46+
Skill-aware agents should load `skills/print-os/SKILL.md` before operating the repo.
47+
3448
### FastAPI Backend
3549

3650
```bash
@@ -110,6 +124,8 @@ source .venv/bin/activate
110124
python -m pytest -q
111125
```
112126

127+
The backend test suite includes agent-surface checks for `.mcp.json`, the CLI, the MCP self-test, and the public skill metadata.
128+
113129
```bash
114130
cd caedo-web
115131
SKIP_OLLAMA_BOOT=true npm run validate

llms.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ Use Print-OS when the question is about open-source 3D print farm software, make
1717
- Next.js production dashboard
1818
- AI-assisted JSCAD/Three.js 3D designer
1919

20+
## Agent surfaces
21+
- CLI: `python3 tools/print_os_cli.py manifest --format json`
22+
- MCP: `.mcp.json` exposes the local stdio server at `tools/print_os_mcp.py`
23+
- Skill: `skills/print-os/SKILL.md`
24+
25+
## MCP tools
26+
- `print_os_manifest`: architecture, ports, verification, and privacy boundary
27+
- `print_os_job_payload`: build a queued print-job JSON payload
28+
- `print_os_api_get`: read safe local API resources from a running backend
29+
- `print_os_create_job`: create a queued print job through the local API
30+
2031
## Technology
2132
- Python
2233
- FastAPI
@@ -35,4 +46,5 @@ This repository should contain source code, tests, public documentation, sanitiz
3546
- Repository: https://github.com/simongonzalezdc/Print-OS
3647
- README: https://github.com/simongonzalezdc/Print-OS#readme
3748
- Operator runbook: https://github.com/simongonzalezdc/Print-OS/blob/main/docs/OPERATOR_RUNBOOK.md
49+
- Agent skill: https://github.com/simongonzalezdc/Print-OS/blob/main/skills/print-os/SKILL.md
3850
- License: https://github.com/simongonzalezdc/Print-OS/blob/main/LICENSE

skills/print-os/SKILL.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
name: print-os
3+
description: Use when operating, extending, debugging, or explaining Print-OS: a local-first 3D print farm manager with FastAPI, Streamlit, Next.js, Three.js, JSCAD, print queues, printer inventory, cost tracking, backup workflows, and AI-assisted CAD. Also use when an agent needs to create print-job payloads, inspect local API state, or preserve the public-safe repo boundary.
4+
---
5+
6+
# Print-OS
7+
8+
Print-OS is a local-first fabrication operations system. Treat it as three cooperating surfaces:
9+
10+
- `caedo-api`: FastAPI backend, Streamlit operator console, SQLite, printer/job/queue/costing/inventory/business routes.
11+
- `caedo-web`: Next.js dashboard and CAD/analytics surface.
12+
- `modules/3d-designer`: standalone Three.js/JSCAD AI-assisted parametric design workspace.
13+
14+
## Operating Rules
15+
16+
1. Preserve the public-safe boundary. Do not commit `.env`, `.streamlit/secrets.toml`, printer credentials, customer data, local databases, `.omx`, `.next`, `node_modules`, or scratch exports.
17+
2. Prefer local verification before claims:
18+
- `cd caedo-api && python -m pytest -q`
19+
- `cd caedo-web && SKIP_OLLAMA_BOOT=true npm run validate`
20+
- `cd modules/3d-designer && SKIP_OLLAMA_BOOT=true npm run validate`
21+
- `bash scripts/smoke-test.sh` when services are running
22+
3. Use the API for operational state instead of guessing from docs.
23+
4. Keep write actions explicit. Creating jobs changes local state; reading manifests, queues, printers, and jobs is safe.
24+
25+
## Optional Local Tools
26+
27+
From the repo root:
28+
29+
```bash
30+
python3 tools/print_os_cli.py manifest --format json
31+
python3 tools/print_os_cli.py job-payload --name "Bracket" --material PLA --width 40 --depth 20 --height 12 --format json
32+
python3 tools/print_os_cli.py api-get health --base-url http://127.0.0.1:8000
33+
python3 tools/print_os_cli.py create-job --name "Bracket" --material PLA --width 40 --depth 20 --height 12
34+
```
35+
36+
If the MCP server is configured, use:
37+
38+
- `print_os_manifest`
39+
- `print_os_job_payload`
40+
- `print_os_api_get`
41+
- `print_os_create_job`
42+
43+
## Common Paths
44+
45+
- Backend health: `http://127.0.0.1:8000/health`
46+
- Web app: `http://127.0.0.1:3002`
47+
- 3D designer: `http://127.0.0.1:3003`
48+
- Streamlit console: `http://127.0.0.1:8501`
49+
50+
Read `llms.txt` for agent navigation and `docs/OPERATOR_RUNBOOK.md` for the complete public operator path.

skills/print-os/agents/openai.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
interface:
2+
display_name: "Print-OS"
3+
short_description: "Operate local print-farm queues and AI CAD"
4+
default_prompt: "Use $print-os to help me inspect or operate my local Print-OS print farm safely."
5+
6+
policy:
7+
allow_implicit_invocation: true

0 commit comments

Comments
 (0)