Issue
#52
adds an optional local approval-gated harness around the deterministic
agent-librarian CLI backend.
The prototype demonstrates this bounded sequence:
explicit request input
-> scope and sensitivity check
-> exact command proposal
-> exact approval gate
-> deterministic CLI backend execution
-> optional runtime, approval, and execution records
-> optional review-summary handoff shape
This prototype is not an autonomous LLM agent. It does not call an LLM provider. It does not add network behavior. It does not expose arbitrary shell execution. It is a local approval-gated harness around the deterministic CLI backend.
The module is available through:
python -m agent_librarian.runtime_wrapper
It is intentionally separate from the stable agent-librarian console
script. The existing catalog, validate, and report commands remain
directly usable and remain the source of truth.
The wrapper implements a narrow part of the designs in:
- CLI tool contract
- Catalog-review workflow
- LLM-layer public-safety policy
- Safe-scan eval cases
- Runtime state and approval records
- Review summary schema
Only these command forms are supported:
agent-librarian catalog SOURCE_DIR --out OUTPUT_DIR
agent-librarian validate CATALOG_DIR
agent-librarian report CATALOG_DIR
catalog also supports the existing documented --include, --exclude, and
--strict arguments. The wrapper rejects unsupported actions and arguments.
It calls the existing Python CLI dispatcher with a fixed argument list. It
does not pass a free-form command string to a shell.
propose prints JSON containing:
- the exact command
- expected reads
- expected writes and generated files
- the approval instruction
- the sensitivity class and warning
- source-protection and non-certification notes
- the optional review-summary schema reference
Proposal mode does not run the backend or write generated catalog outputs.
It writes a runtime-state draft only when --state-out PATH is explicit.
python -m agent_librarian.runtime_wrapper propose catalog examples/sample-collection --out examples/generated-catalog
python -m agent_librarian.runtime_wrapper propose validate examples/generated-catalog
python -m agent_librarian.runtime_wrapper propose report examples/generated-catalogrun requires --approve-exact. The value must match the generated command
string exactly. Approval for one action, path, or optional-argument set does
not authorize another.
python -m agent_librarian.runtime_wrapper run report examples/generated-catalog --approve-exact "agent-librarian report examples/generated-catalog"An absent or different approval returns a nonzero status without executing the backend. Shell control characters and command-substitution syntax are rejected in paths and optional arguments.
The prototype accepts:
synthetic-public
private-local
work-internal
unclear
Paths under examples/ default to synthetic-public. Other paths default to
unclear.
synthetic-publicmay run after exact approval.private-localmay run after exact approval and emits a private-output warning.work-internalmay be proposed but is blocked from execution by this prototype.unclearmay be proposed but is blocked until sensitivity is explicit.
Generated catalog outputs and explicit records inherit source sensitivity. The wrapper does not publish outputs or certify them as safe to publish.
For a non-example path, set sensitivity explicitly:
python -m agent_librarian.runtime_wrapper run validate PRIVATE_CATALOG --sensitivity private-local --approve-exact "agent-librarian validate PRIVATE_CATALOG"--records-out DIR writes these compact JSON files:
runtime-state.json
approval-log.json
execution-record.json
No runtime records are written by default. Records contain scope, command, approval, identifiers, status, and generated file paths. They do not retain source contents, CLI stdout, CLI stderr, or report text.
Records are explicit user-managed artifacts. Private records remain private and should not be committed as public examples.
Proposal JSON points to the optional review summary schema. This prototype does not generate a model-authored summary. Any later summary must remain secondary to deterministic CLI files and command results.
The prototype does not add:
- an LLM provider or model call
- network access
- an MCP server, web UI, or background daemon
- arbitrary shell execution or command chaining
- source execution, editing, deletion, or merging
- publication or certification behavior
- durable memory or automatic scan retention
- changes to deterministic CLI output schemas
python -m pip install -e ".[dev]"
python -m agent_librarian.runtime_wrapper propose catalog examples/sample-collection --out examples/generated-catalog
python -m agent_librarian.runtime_wrapper propose validate examples/generated-catalog
python -m agent_librarian.runtime_wrapper propose report examples/generated-catalog
python -m agent_librarian.runtime_wrapper run report examples/generated-catalog --approve-exact "wrong command"
pytest
git diff --check
git diff --exit-code -- examples/generated-catalogThe wrong-command example is expected to fail.
This is a local orchestration prototype, not a complete interaction layer. It does not interpret natural-language requests, make model-authored summaries, or define a long-term persistence system.
Related design work: