Agent skills

The skills plugin generates agent skills for one database from its stored definitions. While the database is open, it updates them in the configured output directory. An agent harness that reads SKILL.md files learns from them how to operate this database through the bindings.

Enable skills in the plugin selection at open, with the settings below. Calls without it report the unavailable status.

Settings

Set dir to a dedicated directory for the skills:

dust92 B
skills {dir      agent/skills
        debounce {#dur PT0.25S}
        maxWait  {#dur PT2S}}
MemberValueResult
dirDirectory pathA dedicated directory for the skills. The plugin controls all its contents. A relative path is relative to the working directory of the process at open. A missing directory is created.
sitehttp or https origin, the Stardust website when absentThe website that the skills link for Reference and Theory articles.
debounce#dur duration, PT0.25S when absentHow long definition commits must stay quiet before the plugin generates again.
maxWait#dur duration, PT2S when absentThe longest wait after the first definition commit.

Without dir, the plugin publishes nothing. sync then generates the skills without writing them, which reports naming failures. Settings apply until the database closes.

The skills

Each skill is a directory with a SKILL.md file whose frontmatter names the skill and describes when to use it.

SkillContents
stardustOpening the database, its data model, and the other skills
stardust-queryStored and inline queries, with a reference file per stored query
stardust-mutateMutations, with a reference file per stored mutation
stardust-schemaSchemas, with a reference file per stored schema
stardust-expressionExpressions and macros, with a reference file per stored expression and macro
stardust-entitiesMerge patches, temporary names and conditional writes
stardust-liveQuery subscriptions
stardust-importImporting an external dataset
stardust-objectsThe object store, only when the database enables objects
stardust-opsIndexes, plans, history and the plugins that the database enables

A reference file lists a definition's parameters, result and stored document in DUST, for example stardust-query/reference/queries/people__adults.md for the query people/adults. When the database also enables SDK generation with output languages, each query, mutation and expression reference shows the generated typed call in each of those languages. Without them, the reference names the generic operations to call. Guidance for each plugin appears only when the database enables that plugin. Supported plugins include reactors, history, objects, backups, adaptive planner and blackholes. The skills link the published Reference and Theory articles instead of copying them.

Copy or link the whole output directory into the harness's skills directory, so that each skill keeps its reference files.

Runs

The plugin generates the skills when the database opens, then again after definition commits, after the debounce. Data commits do not start a run. A run replaces the complete contents of the directory. Two definitions whose file names collide, such as the queries a/b and a__b, fail the run: the directory keeps the last skills, and status reports the failure with its diagnostics.

status returns a document with these members:

MemberContents
enabledAlways true
pendingWhether a definition change waits for a run
runsFinished runs since open
fingerprintThe native SHA-256 value {#sha256 ...} for the definitions that the last run described; absent before a model is built
failureThe last run's code and message; absent after a successful run
outputsThe published directory with the files written and removed
diagnosticsEach diagnostic about a definition

When to call sync

Your definition commit can finish before the skills describe it. Call sync before an agent reads skills that must include a definition you just stored. Its options accept only the common maxWait option. Success covers the definitions committed before the call. A failed run reports failed.

File ownership

The plugin owns the entire output directory and clears it before every successful run, including its first run after open. Keep other files and databases elsewhere. A failed write can leave the directory empty or partial; the next successful run rebuilds it.

Operations

OperationReturnsSummary
skills-statusdocumentskills.status() returns the agent skills generator's owned status document.
skills-syncnoneskills.sync(options) waits until the agent skills include the definitions committed before the call.

skills-status

clojure4 B
[db]

Parameters

ParameterTypeOwnershipDefaultMeaning
dbSkillsBorrowed for the callRequiredThe skills owner for this operation. Keep it alive during the call.

Errors

StatusWhen
:unavailablethe database does not enable the skills plugin
:closedthe database is closed
:out-of-memorynative memory is exhausted

Notes

The document describes the published directory, diagnostics and the last run: see runs.

Examples

Describe the agent skills generator

clojure124 B
(with-open [sync-options (sd/parse "{maxWait {#dur PT5S}}" :dust)]
  (sd/skills-sync db sync-options))
(sd/skills-status db)
Result / 140 B
{enabled     true
 pending     false
 runs        1
 fingerprint {#sha256 c85ad5b5d9bd69a0f68d092b7b09830897487a77f488c6a7218cda6dea3f3dfd}}

C exports: stardust_db_plugin_call, stardust_result_take_document, stardust_result_error, stardust_result_release

skills-sync

clojure4 B
[db]
clojure12 B
[db options]

Parameters

ParameterTypeOwnershipDefaultMeaning
dbSkillsBorrowed for the callRequiredThe skills owner for this operation. Keep it alive during the call.
optionsDocumentBorrowed for the callAbsent selects operation defaultsThe borrowed call options, or none. Optional maxWait is a nonnegative native duration, such as {maxWait {#dur PT5S}}. Without it, or with zero, the call checks once.

Errors

StatusWhen
:invalid-argumentoptions is not an object, or an option is invalid, duplicated or unsupported
:failedthe plugin's work failed; status describes the failure
:timeoutmaxWait passed before the work finished
:unavailablethe database does not enable the skills plugin
:closedthe database is closed

Notes

Database close interrupts an active wait. See when to call sync.

Examples

Run the agent skills generator and wait for it

clojure124 B
(with-open [sync-options (sd/parse "{maxWait {#dur PT5S}}" :dust)]
  (sd/skills-sync db sync-options))
(sd/skills-status db)
Result / 140 B
{enabled     true
 pending     false
 runs        1
 fingerprint {#sha256 c85ad5b5d9bd69a0f68d092b7b09830897487a77f488c6a7218cda6dea3f3dfd}}

C exports: stardust_db_plugin_call, stardust_result_take_document, stardust_result_error, stardust_result_release