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:

TRON154 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
044C 23647572txt "#dur"
097C 5054302E323553txt "PT0.25S"
110F 0A 04000000 0900 0000map leaf, size 10: @4 → @9
1B4C 23647572txt "#dur"
204C 50543253txt "PT2S"
250F 0A 1B000000 2000 0000map leaf, size 10: @1B → @20
2F8C 6465626F756E63 65txt "debounce"
380F 0A 2F000000 1100 0000map leaf, size 10: @2F → @11
427C 6D617857616974txt "maxWait"
4A0F 0A 42000000 2500 0000map leaf, size 10: @42 → @25
543C 646972txt "dir"
58CC 6167656E742F73 6B696C6C73txt "agent/skills"
650F 0A 54000000 5800 0000map leaf, size 10: @54 → @58
6F07 12 44010000 3800 0000 4A000000 6500 0000map branch, size 18, depth 0 (root), slots 2, 6, 8: @38 → @4A → @65
816C 736B696C6C73txt "skills"
880F 0A 81000000 6F00 0000map leaf, size 10: @81 → @6F
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

odin98 B
skills_status :: proc(
	db: Database,
	allocator := context.allocator,
) -> (
	Document,
	Error,
)

Parameters

ParameterTypeOwnershipDefaultMeaning
dbDatabaseBorrowed for the callRequiredThe skills owner for this operation. Keep it alive during the call.
allocatormem.AllocatorValuecontext.allocatorAllocator for copied return values and diagnostics. The caller releases them with the same allocator.

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

odin234 B
sync_options := stardust.parse(`{maxWait {#dur PT5S}}`, .DUST) or_return
defer stardust.close(&sync_options)
stardust.skills_sync(db, sync_options) or_return
result := stardust.skills_status(db) or_return
defer stardust.close(&result)
TRON202 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
047C 23736861323536txt "#sha256"
0C14 40 633835616435 6235643962643639 6130663638643039 3262376230393833 3038393734383761 3737663438386336 6137323138636461 3664656133663364 6664txt "c85ad5b5d9bd69a0f68d092b…"
4E0F 0A 04000000 0C00 0000map leaf, size 10: @4 → @C
584C 72756E73txt "runs"
5D02 01000000000000 00i64 1
660F 0A 58000000 5D00 0000map leaf, size 10: @58 → @5D
707C 656E61626C6564txt "enabled"
7809bit true
790F 0A 70000000 7800 0000map leaf, size 10: @70 → @78
837C 70656E64696E67txt "pending"
8B01bit false
8C0F 0A 83000000 8B00 0000map leaf, size 10: @83 → @8B
96BC 66696E67657270 72696E74txt "fingerprint"
A20F 0A 96000000 4E00 0000map leaf, size 10: @96 → @4E
AC07 16 280A0000 6600 0000 79000000 8C00 0000 A2000000map branch, size 22, depth 0 (root), slots 3, 5, 9, 11: @66 → @79 → @8C → @A2

C exports: stardust_db_plugin_call, stardust_result_take_document, stardust_result_error, stardust_result_release

skills_sync

odin104 B
skills_sync :: proc(
	db: Database,
	options: Document = {},
	allocator := context.allocator,
) -> Error

Parameters

ParameterTypeOwnershipDefaultMeaning
dbDatabaseBorrowed for the callRequiredThe skills owner for this operation. Keep it alive during the call.
optionsDocumentBorrowed for the call{}The 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.
allocatormem.AllocatorValuecontext.allocatorAllocator for copied return values and diagnostics. The caller releases them with the same allocator.

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

odin234 B
sync_options := stardust.parse(`{maxWait {#dur PT5S}}`, .DUST) or_return
defer stardust.close(&sync_options)
stardust.skills_sync(db, sync_options) or_return
result := stardust.skills_status(db) or_return
defer stardust.close(&result)
TRON202 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
047C 23736861323536txt "#sha256"
0C14 40 633835616435 6235643962643639 6130663638643039 3262376230393833 3038393734383761 3737663438386336 6137323138636461 3664656133663364 6664txt "c85ad5b5d9bd69a0f68d092b…"
4E0F 0A 04000000 0C00 0000map leaf, size 10: @4 → @C
584C 72756E73txt "runs"
5D02 01000000000000 00i64 1
660F 0A 58000000 5D00 0000map leaf, size 10: @58 → @5D
707C 656E61626C6564txt "enabled"
7809bit true
790F 0A 70000000 7800 0000map leaf, size 10: @70 → @78
837C 70656E64696E67txt "pending"
8B01bit false
8C0F 0A 83000000 8B00 0000map leaf, size 10: @83 → @8B
96BC 66696E67657270 72696E74txt "fingerprint"
A20F 0A 96000000 4E00 0000map leaf, size 10: @96 → @4E
AC07 16 280A0000 6600 0000 79000000 8C00 0000 A2000000map branch, size 22, depth 0 (root), slots 3, 5, 9, 11: @66 → @79 → @8C → @A2

C exports: stardust_db_plugin_call, stardust_result_take_document, stardust_result_error, stardust_result_release