Prompts Storage
Prompts Storage is Mockarty’s managed home for AI prompt templates. Each prompt is identified by a UUID, carries a body, tags, declared variables, and a 20-version history with one-call rollback.
A prompt is stored once and used by ID, so editing it changes the next use instead of every copy of its text.
In Stores → Prompts, a failed list read shows an error and Retry instead of an empty list. Sign in or request permission when the message calls for it. The saved-prompt picker on AI buttons also reports failed reads. While an existing prompt loads, editing and saving are unavailable; while a save is pending, a second submission is blocked. Switching namespace closes the editor and clears its draft. Closing the editor does not cancel a save already sent to the server: check the prompt before submitting again after a connection problem.
Table of Contents
Why managed prompts?
Prompt engineering is iterative. A team that ships an AI-assisted feature typically tweaks the prompt dozens of times in the first month. Without a store, every tweak means editing scattered templates and redeploying.
With Prompts Storage:
- One source of truth — every consumer references the same prompt ID.
- Safe iteration — every save creates a new version; you can diff, compare, and roll back without losing work.
- Auditable — each version records the author and timestamp.
- Portable — prompts export cleanly for air-gapped deployments.
Versioning model
- The first
POST /api/v1/stores/promptscreates version1. - Every subsequent
PUTthat changes thebodyfield creates a new version. - History is FIFO-capped at 20: when the 21st edit lands, the oldest historical version is dropped. The current version is always accessible via the top-level
GET. - Rollback (
POST /.../rollback?to=N) restores the body from versionN. The current body is itself pushed onto the history stack first — so rolling back never destroys your latest draft. - Namespace: all prompt endpoints accept a
?namespace=query parameter. On create, the body’snamespacefield takes precedence over the query. On the single-template endpoints (GET/PUT/DELETE /api/v1/stores/prompts/{id}, its/versions,/rollback) a caller without a namespace-scoped token that omits the parameter is served from the default namespacesandbox— a template that lives in another namespace then answers 404 naming the searched namespace (for exampleprompt template not found in namespace "sandbox"). Pass?namespace=explicitly when you work across namespaces; a namespace-scoped API token pins the namespace automatically.
Placeholder syntax
Prompt bodies can carry double-curly placeholders. The server parses them out on save into parsedKeys, so a consumer can show which values the prompt expects. The body itself is stored exactly as written.
- Form: two opening curly braces, the placeholder name, two closing
curly braces — for exampleHello, {{username}}, generate a summary of {{report_id}}. - Allowed characters: letters, digits,
_. Names are case-sensitive
but conventionally lowercase. Write the braces unspaced —{{username}}.
Whitespace inside the braces ({{ username }}) is not recognised as a
placeholder. - Parsed keys: the create / update endpoints return a
parsedKeys
array of every unique placeholder seen in the body. The AI button
picker uses this list to render a structured form before invocation. - Declared variables: the prompt can also declare typed variables (name, type, default value, required flag) for the consumers that fill the placeholders in. A placeholder without a declared variable is still recorded in
parsedKeys.
Where stored prompts are used
A stored prompt is currently used as a jury focus lens: in the adjudication panel, each member may name a stored prompt (focusPromptId) that adds a particular review lens to that member’s seats. The current version is loaded when the jury is built, so a rollback changes the next verdict without editing the panel.
Stored prompts are managed through this page, the REST API, MCP and the CLI. They are not currently selectable from the built-in AI buttons or from TCM steps: those surfaces use their own configured text, and a prompt stored here does not change their behaviour.
Rollback always changes what a consumer loads next time, never what it already sent.
SDK and CLI examples
CLI
mockarty-cli prompts create \
--name tcm-step-summarizer \
--body "Summarize the following test step in one sentence: {{step}}" \
--tag tcm --tag summary
mockarty-cli prompts update "$PROMPT_ID" --body "Summarize in 15 words: {{step}}"
mockarty-cli prompts versions list "$PROMPT_ID"
mockarty-cli prompts versions rollback "$PROMPT_ID" 1
Go SDK
p, _ := client.Prompts().Create(ctx, mockarty.Prompt{
Name: "tcm-step-summarizer",
Body: "Summarize the following test step in one sentence: {{step}}",
Tags: []string{"tcm", "summary"},
})
_, _ = client.Prompts().Update(ctx, p.ID, mockarty.Prompt{Body: "Summarize in 15 words: {{step}}"})
versions, _ := client.Prompts().ListVersions(ctx, p.ID)
_ = versions
_, _ = client.Prompts().Rollback(ctx, p.ID, 1)
Python SDK
p = client.prompts.create(
name="tcm-step-summarizer",
body="Summarize the following test step in one sentence: {{step}}",
tags=["tcm", "summary"],
)
client.prompts.update(p["id"], body="Summarize in 15 words: {{step}}")
versions = client.prompts.list_versions(p["id"])
client.prompts.rollback(p["id"], to_version=1)
Java SDK
Map<String, Object> p = client.prompts().create(
"tcm-step-summarizer",
"Summarize the following test step in one sentence: {{step}}",
Map.of("tags", List.of("tcm", "summary")));
client.prompts().update((String) p.get("id"),
Map.of("body", "Summarize in 15 words: {{step}}"));
List<Map<String, Object>> versions = client.prompts().listVersions((String) p.get("id"));
client.prompts().rollback((String) p.get("id"), 1);
See also: AI Features, Secrets Storage.