feat(claw): load skills and subagents and edit the identity files
android / debug (push) Successful in 2m12s
ci / checks (push) Successful in 3m42s
ci / web (push) Successful in 12s
android / release (push) Successful in 2m5s
ci / test (push) Successful in 2m12s
ci / chart (push) Successful in 6s
ci / docker (push) Successful in 1m58s
ci / publish-edge-images (deploy/docker/claw.Dockerfile, rhema-claw) (push) Successful in 1m55s
ci / publish-edge-images (deploy/docker/ui.Dockerfile, rhema-claw-ui) (push) Successful in 15s
ci / publish-edge-chart (push) Successful in 4s

The claw's agents had no skills and no way to delegate, and the settings
surface could only read a pair of booleans.

Skills now seed the bundled `commit-message` and `unslop` folders into
the global directory, discover the global and workspace tiers on every
dispatch, and list them in the prompt. The settings table owns an off
switch per skill, so the Skills page can hold one back without editing
YAML. The config set is the seed.

Subagents build on `rhema-subagents`. Definitions are `SUBAGENT.md`
folders under the global directory and the workspace tier, and the
parent prompt advertises the `subagent` tool. The wire passes the
parent's skills, environment report, and USER.md to the child, so a
delegated turn knows the same context.

The Bootstrap page reads the three identity files and writes SOUL.md
and USER.md. ENVIRONMENT.md stays read-only because the boot pass
rewrites it. The MCP page reads the client's config through the same
file the shell uses and shows servers, transports, and the daemon's
mute set. It stays read-only: the standalone client owns that file.

`GET` and `PUT /v1/bootstrap/{kind}`, `GET /v1/bootstrap/files`, `GET`
and `PUT /v1/skills`, and `GET /v1/mcp` carry the pages. The config
gains `skills_root`, `skills_disabled`, `subagents_root`, and
`disabled_subagents`.

fmt, clippy with -D warnings over all targets, the 304 lib and 46 HTTP
tests, and nuxt typecheck and build pass.
This commit is contained in:
vhaudiquet committed 2026-11-29 23:20:32 +01:00
1 parent eb9f4e9ec5
commit 829f30d27e
31 files changed
+2604 -102

No files matched your search

@@ -0,0 +1,204 @@
<script setup lang="ts">
// The Bootstrap page: the three identity documents the resident prompt
// renders, editable in place. SOUL.md and USER.md save as whole files;
// ENVIRONMENT.md is generated at every boot, so its editor is read-only
// and says so. Presentational: data flows in as props, intent flows up
// as events.
import type { BootstrapFile, BootstrapFiles } from '~/composables/useClaw'
const props = defineProps<{
state: BootstrapFiles | null
loading: boolean
/** The kind whose save is in flight. */
saving: string | null
}>()
const emit = defineEmits<{
refresh: []
save: [kind: string, content: string]
}>()
// 16 KiB, the same cap bootstrap_save enforces in the daemon.
const CAP = 16 * 1024
const drafts = reactive<Record<string, string>>({})
function sync(): void {
const state = props.state
if (!state) return
for (const file of state.files) {
drafts[file.kind] = file.content ?? ''
}
}
// The page's only refresh is explicit, so a state arrival always wins:
// there is no background poll that could overwrite a live edit.
watch(() => props.state, sync, { immediate: true })
function dirty(file: BootstrapFile): boolean {
return (drafts[file.kind] ?? '') !== (file.content ?? '')
}
function discard(file: BootstrapFile): void {
drafts[file.kind] = file.content ?? ''
}
function save(file: BootstrapFile): void {
if (file.generated || props.saving || !dirty(file)) return
emit('save', file.kind, drafts[file.kind] ?? '')
}
function size(file: BootstrapFile): number {
return new TextEncoder().encode(drafts[file.kind] ?? '').length
}
</script>
<template>
<div class="page">
<PageHeader title="Bootstrap" subtitle="The identity files every turn renders.">
<template #actions>
<button :disabled="loading" @click="$emit('refresh')">
{{ loading ? 'Refreshing…' : 'Refresh' }}
</button>
</template>
</PageHeader>
<div class="scroll">
<p v-if="!state" class="muted">loading bootstrap…</p>
<template v-else>
<AppCallout variant="info" title="These files enter every request">
SOUL.md is who the agent is; USER.md is who you are. Keep both
small — they are read on every turn. ENVIRONMENT.md is written
from the machine at boot.
</AppCallout>
<SettingCard
v-for="file in state.files"
:key="file.kind"
:title="file.name"
:meta="file.generated ? 'generated at boot' : file.exists ? 'present' : 'missing'"
>
<div class="editor">
<textarea
v-model="drafts[file.kind]"
class="mono"
rows="10"
spellcheck="false"
:readonly="file.generated"
:disabled="saving === file.kind"
:aria-label="`${file.name} content`"
/>
<div class="editor-foot">
<span class="hint">
<template v-if="file.generated">
Rewritten at every boot; edit the template, not this file.
</template>
<template v-else>
{{ size(file) }} of {{ CAP }} bytes
<span v-if="size(file) > CAP" class="over">over the cap</span>
</template>
</span>
<span class="actions">
<button
v-if="!file.generated"
:disabled="!dirty(file) || saving === file.kind"
@click="discard(file)"
>
Discard
</button>
<button
v-if="!file.generated"
class="primary"
:disabled="!dirty(file) || saving === file.kind || size(file) > CAP"
@click="save(file)"
>
{{ saving === file.kind ? 'Saving…' : 'Save' }}
</button>
</span>
</div>
</div>
</SettingCard>
<p class="footnote">
The agent can also write SOUL.md and USER.md through its
<code>bootstrap_save</code> tool. Both paths land in the same
store, so the next turn sees either.
</p>
</template>
</div>
</div>
</template>
<style scoped>
.page {
display: flex;
flex-direction: column;
min-height: 0;
min-width: 0;
flex: 1;
}
.scroll {
flex: 1;
overflow-y: auto;
padding: 0 24px 24px;
display: flex;
flex-direction: column;
gap: 16px;
max-width: 900px;
}
.muted {
color: var(--text3);
}
.editor {
display: flex;
flex-direction: column;
gap: 10px;
padding: 14px 16px;
}
textarea {
width: 100%;
min-height: 180px;
resize: vertical;
line-height: 1.5;
font-size: 12.5px;
}
textarea[readonly] {
color: var(--text2);
background: var(--sunken);
}
.editor-foot {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
}
.hint {
color: var(--text3);
font-size: 11.5px;
}
.over {
color: var(--error);
}
.actions {
display: flex;
align-items: center;
gap: 8px;
}
.footnote {
margin: 0;
padding: 0 2px;
color: var(--text3);
font-size: 12px;
}
</style>