@synadia-ai/agent-fabric-claude-code 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +10 -0
- package/.mcp.json +14 -0
- package/BUILD +4 -0
- package/LICENSE +202 -0
- package/README.md +76 -2
- package/hooks/hooks.json +46 -0
- package/hooks/session-event.js +11 -0
- package/hooks/session-start.sh +28 -0
- package/package.json +38 -4
- package/runtime/chunk-prncr0vg.js +38 -0
- package/runtime/fabric.js +7 -0
- package/runtime/server.js +63 -0
- package/skills/configure/SKILL.md +190 -0
- package/skills/configure/list-contexts.sh +22 -0
- package/skills/scratchpad/LICENSE +201 -0
- package/skills/scratchpad/SKILL.md +209 -0
- package/skills/scratchpad/THIRD_PARTY_NOTICES +1067 -0
- package/skills/scratchpad/bin/BUILD.json +367 -0
- package/skills/scratchpad/bin/COMMIT +1 -0
- package/skills/scratchpad/bin/sp-darwin-amd64 +0 -0
- package/skills/scratchpad/bin/sp-darwin-arm64 +0 -0
- package/skills/scratchpad/bin/sp-linux-amd64 +0 -0
- package/skills/scratchpad/bin/sp-linux-arm64 +0 -0
- package/skills/scratchpad/scripts/sp +231 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: configure
|
|
3
|
+
description: Configure NATS channel - select context, set owner/session, sender identity, inbound trust, and permissions. Use when user asks to set up NATS, connect to NATS, change context, identity, trust, or permissions.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Bash(ls *)
|
|
9
|
+
- Bash(mkdir *)
|
|
10
|
+
- Bash(nats context ls *)
|
|
11
|
+
- Bash(cat *)
|
|
12
|
+
- Bash(*list-contexts*)
|
|
13
|
+
effort: low
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# /nats-channel:configure - NATS Channel Configuration
|
|
17
|
+
|
|
18
|
+
Configures the NATS channel plugin: connection context, session name, sender
|
|
19
|
+
identity, inbound sender trust, and permission handling. State lives in
|
|
20
|
+
`~/.claude/channels/nats/config.json`.
|
|
21
|
+
|
|
22
|
+
Arguments passed: `$ARGUMENTS`
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Dispatch on arguments
|
|
27
|
+
|
|
28
|
+
### No args - status, list, and offer to change
|
|
29
|
+
|
|
30
|
+
Read state and give the user a complete picture, then ask:
|
|
31
|
+
|
|
32
|
+
1. **Current config** - read `~/.claude/channels/nats/config.json`. Show:
|
|
33
|
+
- Selected context name (or "none - using demo.nats.io")
|
|
34
|
+
- Owner override (if set)
|
|
35
|
+
- Session name override (if set)
|
|
36
|
+
- Sender identity mode (`off` or `signed`; default `off`)
|
|
37
|
+
- Minimum sender trust (`any` or `signed`; default `any`)
|
|
38
|
+
- Connection URL and description from the context file
|
|
39
|
+
- Permission mode (`terminal` or `query`) and whether permission prompts
|
|
40
|
+
will be relayed as NATS query chunks or handled in the local terminal
|
|
41
|
+
|
|
42
|
+
2. **Available contexts** - run the `list-contexts.sh` script bundled
|
|
43
|
+
alongside this skill file to list all NATS CLI contexts with their
|
|
44
|
+
URL and description.
|
|
45
|
+
|
|
46
|
+
3. **Ask the user** - show the numbered list of available contexts and
|
|
47
|
+
ask if they'd like to switch. Example:
|
|
48
|
+
- *"Currently using `<name>`. Available contexts:"*
|
|
49
|
+
- *(numbered list)*
|
|
50
|
+
- *"Would you like to switch? Enter a context name or number, or
|
|
51
|
+
'no' to keep the current selection."*
|
|
52
|
+
If no config is set, skip straight to asking them to pick one.
|
|
53
|
+
|
|
54
|
+
### `list` - list available NATS contexts
|
|
55
|
+
|
|
56
|
+
Two separate steps - do NOT combine into one Bash call:
|
|
57
|
+
|
|
58
|
+
1. Bash: run the `list-contexts.sh` script bundled alongside this skill
|
|
59
|
+
file. It produces no stdout - it writes to a file.
|
|
60
|
+
2. Read: open `~/.claude/channels/nats/.contexts` and present the
|
|
61
|
+
markdown table to the user.
|
|
62
|
+
|
|
63
|
+
### `<context-name>` - select a context
|
|
64
|
+
|
|
65
|
+
1. Treat `$ARGUMENTS` as the context name (trim whitespace).
|
|
66
|
+
2. Verify `~/.config/nats/context/<name>.json` exists. If not, show
|
|
67
|
+
available contexts and error.
|
|
68
|
+
3. Read the context file. Show the URL and description so the user can
|
|
69
|
+
confirm it's correct.
|
|
70
|
+
4. `mkdir -p ~/.claude/channels/nats`
|
|
71
|
+
5. Read existing `config.json` if present; update/add the `context` field,
|
|
72
|
+
preserve other fields (like `sessionName`, `permissions`). Write back.
|
|
73
|
+
6. Confirm, then show the status view so the user sees where they stand.
|
|
74
|
+
|
|
75
|
+
### `session <name>` - set session name override
|
|
76
|
+
|
|
77
|
+
1. The session name is the 5th token in the v0.3 verb-first subject
|
|
78
|
+
`agents.prompt.cc.<owner>.<name>`. It defaults to the working directory
|
|
79
|
+
basename. This command overrides it.
|
|
80
|
+
2. Read existing `config.json` (or start fresh). Set `sessionName` field.
|
|
81
|
+
Write back.
|
|
82
|
+
3. Confirm the override.
|
|
83
|
+
|
|
84
|
+
### `session clear` - remove session name override
|
|
85
|
+
|
|
86
|
+
Remove the `sessionName` field from `config.json` so the default
|
|
87
|
+
(CWD basename) is used.
|
|
88
|
+
|
|
89
|
+
### `owner <name>` - set owner override
|
|
90
|
+
|
|
91
|
+
1. The owner is the 4th token in the v0.3 verb-first subject
|
|
92
|
+
`agents.prompt.cc.<owner>.<name>`. It defaults to the sanitized
|
|
93
|
+
`$USER`. This command overrides it — useful for service accounts or
|
|
94
|
+
deployment-scoped owners.
|
|
95
|
+
2. Read existing `config.json` (or start fresh). Set the `owner` field.
|
|
96
|
+
Write back.
|
|
97
|
+
3. Confirm the override. Note: the `SYNADIA_CLAUDE_CODE_OWNER` and
|
|
98
|
+
`SYNADIA_OWNER` env vars take precedence over this config field.
|
|
99
|
+
|
|
100
|
+
### `owner clear` - remove owner override
|
|
101
|
+
|
|
102
|
+
Remove the `owner` field from `config.json` so the default (sanitized
|
|
103
|
+
`$USER`) is used.
|
|
104
|
+
|
|
105
|
+
### `identity off` - disable host identity
|
|
106
|
+
|
|
107
|
+
Set `senderIdentity` to `"off"`. The channel performs no host identity lookup
|
|
108
|
+
and registers no identity metadata. This is the default and works with
|
|
109
|
+
token/password authentication and servers where user-info lookup is not
|
|
110
|
+
permitted. It does not change inbound sender policy.
|
|
111
|
+
|
|
112
|
+
### `identity signed` - use the connection identity
|
|
113
|
+
|
|
114
|
+
Set `senderIdentity` to `"signed"`. The selected NATS context must contain a
|
|
115
|
+
user seed (`creds`, `nkey`, or `user_jwt` plus `user_seed`). The same immutable
|
|
116
|
+
credential snapshot supplies both connection authentication and signing; never
|
|
117
|
+
ask for or add a second identity credential. Signed startup fails rather than
|
|
118
|
+
downgrading when the connection cannot be bound to that signer.
|
|
119
|
+
|
|
120
|
+
`NATS_SENDER_IDENTITY` overrides this config field. A plugin reload or Claude
|
|
121
|
+
Code restart is required after changing it.
|
|
122
|
+
|
|
123
|
+
### `trust any` - accept all sender trust classes
|
|
124
|
+
|
|
125
|
+
Set `minSenderTrust` to `"any"`. Headerless, claimed, and verified prompts are
|
|
126
|
+
admitted. This is the backward-compatible default and is independent of the
|
|
127
|
+
channel's own identity.
|
|
128
|
+
|
|
129
|
+
### `trust signed` - require verified senders
|
|
130
|
+
|
|
131
|
+
Set `minSenderTrust` to `"signed"`. Headerless, claimed, malformed, stale, and
|
|
132
|
+
replayed requests are rejected before an acknowledgement and before Claude sees
|
|
133
|
+
the prompt. `NATS_MIN_SENDER_TRUST` overrides this config field.
|
|
134
|
+
|
|
135
|
+
### `permissions terminal` - use terminal for permission prompts
|
|
136
|
+
|
|
137
|
+
Set `permissions.mode` to `terminal`. Permission prompts will appear in the
|
|
138
|
+
Claude Code terminal session. This is the simplest option when the operator
|
|
139
|
+
has direct terminal access, and the default when no permissions block is set.
|
|
140
|
+
|
|
141
|
+
1. Read existing `config.json` (or start fresh).
|
|
142
|
+
2. Set `permissions` to `{ "mode": "terminal" }`.
|
|
143
|
+
3. Write back and confirm.
|
|
144
|
+
|
|
145
|
+
### `permissions query` - relay permissions as query chunks
|
|
146
|
+
|
|
147
|
+
Set `permissions.mode` to `query`. When Claude needs permission to use a
|
|
148
|
+
tool during an active NATS prompt, the plugin emits a protocol `query`
|
|
149
|
+
chunk (§7 of the Synadia Agent Protocol for NATS) on the active stream's reply
|
|
150
|
+
subject. The caller replies with `yes`/`no` on the query's dynamic reply
|
|
151
|
+
inbox, and the plugin forwards the decision back to the Claude Code
|
|
152
|
+
harness. The legacy value `"nats"` is accepted as an alias for
|
|
153
|
+
backward compatibility.
|
|
154
|
+
|
|
155
|
+
If Claude asks for permission while no NATS request is active, the request
|
|
156
|
+
is denied (there is no open stream to carry a query chunk on). Operators
|
|
157
|
+
who need terminal-style prompting in that case should use `permissions
|
|
158
|
+
terminal` instead.
|
|
159
|
+
|
|
160
|
+
1. Read existing `config.json` (or start fresh).
|
|
161
|
+
2. Set `permissions` to `{ "mode": "query" }`.
|
|
162
|
+
3. Write back and confirm.
|
|
163
|
+
|
|
164
|
+
### `permissions clear` - reset to default
|
|
165
|
+
|
|
166
|
+
Remove the `permissions` field from `config.json`, restoring the default
|
|
167
|
+
behavior (terminal-mode prompts).
|
|
168
|
+
|
|
169
|
+
### `clear` - remove config
|
|
170
|
+
|
|
171
|
+
Delete `~/.claude/channels/nats/config.json`.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Implementation notes
|
|
176
|
+
|
|
177
|
+
- The channels dir might not exist if the server hasn't run yet. Missing
|
|
178
|
+
file = not configured, not an error.
|
|
179
|
+
- The server reads `config.json` once at boot. Config changes need a
|
|
180
|
+
session restart or `/reload-plugins`. Say so after saving.
|
|
181
|
+
- NATS CLI contexts live in `~/.config/nats/context/<name>.json`. Each
|
|
182
|
+
file contains `url`, `description`, `creds`, `nkey`, `user`, `password`,
|
|
183
|
+
`token`, `cert`, `key`, `ca`, and other fields.
|
|
184
|
+
- Do not modify NATS CLI context files - only read them.
|
|
185
|
+
- `senderIdentity` and `minSenderTrust` are independent. Do not enable strict
|
|
186
|
+
inbound policy merely because signed host identity was enabled.
|
|
187
|
+
- Legacy configs with `"mode": "nats"` are still accepted and treated as
|
|
188
|
+
the new `"query"` mode; they do not need to be rewritten.
|
|
189
|
+
- Legacy configs with `permissions.subject` are silently ignored - query
|
|
190
|
+
chunks use a dynamic reply inbox per request, not a fixed subject.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# List NATS CLI contexts as a markdown table.
|
|
3
|
+
# Writes to ~/.claude/channels/nats/.contexts for the skill to Read.
|
|
4
|
+
|
|
5
|
+
CONTEXT_DIR="${HOME}/.config/nats/context"
|
|
6
|
+
STATE_DIR="${HOME}/.claude/channels/nats"
|
|
7
|
+
OUT="${STATE_DIR}/.contexts"
|
|
8
|
+
|
|
9
|
+
mkdir -p "$STATE_DIR"
|
|
10
|
+
|
|
11
|
+
if [ ! -d "$CONTEXT_DIR" ]; then
|
|
12
|
+
echo "No NATS contexts found (${CONTEXT_DIR} does not exist)" > "$OUT"
|
|
13
|
+
exit 0
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
{
|
|
17
|
+
echo "| Name | URL | Description |"
|
|
18
|
+
echo "|------|-----|-------------|"
|
|
19
|
+
jq -r 'input_filename as $f |
|
|
20
|
+
[($f | split("/") | last | rtrimstr(".json")), (.url // "-"), (.description // "-")] |
|
|
21
|
+
"| \(.[0]) | \(.[1]) | \(.[2]) |"' "$CONTEXT_DIR"/*.json 2>/dev/null
|
|
22
|
+
} > "$OUT"
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Support. While redistributing the Work or
|
|
166
|
+
Derivative Works thereof, You may choose to offer, and charge a fee
|
|
167
|
+
for, acceptance of support, warranty, indemnity, or other liability
|
|
168
|
+
obligations and/or rights consistent with this License. However, in
|
|
169
|
+
accepting such obligations, You may act only on Your own behalf and
|
|
170
|
+
on Your sole responsibility, not on behalf of any other Contributor,
|
|
171
|
+
and only if You agree to indemnify, defend, and hold each Contributor
|
|
172
|
+
harmless for any liability incurred by, or claims asserted against,
|
|
173
|
+
such Contributor by reason of your accepting any such warranty or
|
|
174
|
+
additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Synadia Communications
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
200
|
+
implied. See the License for the specific language governing permissions
|
|
201
|
+
and limitations under the License.
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scratchpad
|
|
3
|
+
description: Read ScratchPad references (sp-r1:… or sp-ref:…) handed to you, and publish, share, hydrate and recover bounded ScratchPad artifacts of your own, through this skill's scripts/sp.
|
|
4
|
+
allowed-tools: Bash(${CLAUDE_SKILL_DIR}/scripts/sp *)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# ScratchPad
|
|
8
|
+
|
|
9
|
+
Adapted from the canonical ScratchPad skill for an agent on the fabric.
|
|
10
|
+
The packaged `bin/BUILD.json` records the release, opaque source identifier,
|
|
11
|
+
toolchain, targets, and executable hashes. `LICENSE` and
|
|
12
|
+
`THIRD_PARTY_NOTICES` contain the distribution terms.
|
|
13
|
+
Run the sp command line only as this skill's `scripts/sp`, by its absolute
|
|
14
|
+
path: the directory of this file, then `scripts/sp`. In the examples below,
|
|
15
|
+
`scripts/sp` stands for that path.
|
|
16
|
+
|
|
17
|
+
Run each `scripts/sp` command on its own: its absolute path written out in
|
|
18
|
+
full, no shell variable for it, no `cd`, `;` or `&&` around it, and its
|
|
19
|
+
output not piped into another command. Content may come in on standard
|
|
20
|
+
input (`printf '%s\n' "$TEXT" | scripts/sp publish-file --source - …`).
|
|
21
|
+
Decode `data_base64` in a command of its own:
|
|
22
|
+
`echo "$DATA_BASE64" | base64 -d`. A harness that asks before running a
|
|
23
|
+
shell command can then allow `scripts/sp` by its path, and does not ask.
|
|
24
|
+
|
|
25
|
+
`scripts/sp` adds what the examples in ScratchPad's own skill pass by hand:
|
|
26
|
+
the NATS server, this agent's credentials, its workspace, its volume on
|
|
27
|
+
`init`, the trace of the prompt you are serving, your address as the
|
|
28
|
+
creator of what you publish, and the agent that prompted you as the grantee
|
|
29
|
+
of a grant. Never pass `--url`, `--creds`, `--dir`, `--volume`,
|
|
30
|
+
`--thread-id`, `--root-id`, `--creator`, `--grantee-account` or
|
|
31
|
+
`--grantee-user` yourself; `scripts/sp` refuses them.
|
|
32
|
+
|
|
33
|
+
## Keep identity and recovery state
|
|
34
|
+
|
|
35
|
+
The connection uses this agent's own identity.
|
|
36
|
+
The service authenticates the connection; a reference, creator label, or trace field supplies no identity.
|
|
37
|
+
The workspace is private to this agent and persists across restarts.
|
|
38
|
+
|
|
39
|
+
Each successful command prints JSON.
|
|
40
|
+
Read the returned receipt before reporting that publication succeeded.
|
|
41
|
+
An upload alone does not publish a checkpoint.
|
|
42
|
+
Retention preserves the root until explicit release.
|
|
43
|
+
Its deadline permits later client cleanup.
|
|
44
|
+
A grant separately permits one authenticated principal to read that root and path.
|
|
45
|
+
Do not print credential contents.
|
|
46
|
+
|
|
47
|
+
## Read an artifact handed to you
|
|
48
|
+
|
|
49
|
+
A reference is one token that starts with `sp-r1:`. Copy the complete token exactly.
|
|
50
|
+
Services that do not enable short references return a longer `sp-ref:` token; copy that token unchanged too.
|
|
51
|
+
Keep the returned token in prompts and replies. Do not expand, shorten, repair, or reconstruct it.
|
|
52
|
+
A short reference can be read after an agent restart; it does not depend on a session alias table.
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
scripts/sp read --ref "$REFERENCE"
|
|
56
|
+
scripts/sp hydrate --ref "$REFERENCE" --destination "$DESTINATION"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Read returns verified bytes as `data_base64` and their count as `bytes`; decode `data_base64` to get the content.
|
|
60
|
+
Read accepts files up to 16 MiB; use hydration for larger files and directory trees.
|
|
61
|
+
`limits.read_bytes` from `info` bounds one service range request; the CLI combines ranges for this buffered read.
|
|
62
|
+
Hydrate requires a destination that does not exist.
|
|
63
|
+
It verifies content identities before completing files, and reports the files, directories, symbolic links and bytes it installed.
|
|
64
|
+
Failure can leave a partial destination; preserve that path for inspection.
|
|
65
|
+
An expired reference or refused grant does not authorize another identity or path.
|
|
66
|
+
|
|
67
|
+
## Initialize and inspect
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
scripts/sp info
|
|
71
|
+
scripts/sp init --operation-id "$CREATE_ID"
|
|
72
|
+
scripts/sp describe
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`info` returns this agent's authenticated principal, owned scope allowances, and request limits.
|
|
76
|
+
It needs no initialized workspace and changes no recovery state.
|
|
77
|
+
The scope byte and object figures are configured allowances; `describe` shows current usage.
|
|
78
|
+
An empty scope list needs an operator admission check before this agent can publish.
|
|
79
|
+
Volumes readable through another owner's grant are not listed; their granted references can still be read.
|
|
80
|
+
If `info` reports an unknown command, an older binary was selected; continue with the existing commands and ask the operator for the allowances.
|
|
81
|
+
|
|
82
|
+
`init` creates this agent's volume once; publishing needs it.
|
|
83
|
+
Rerun the saved creation action after an unknown outcome.
|
|
84
|
+
An established writer whose journal disappeared requires an explicit reset.
|
|
85
|
+
Initialization cannot silently reset that writer.
|
|
86
|
+
|
|
87
|
+
## Publish a file and share it with the agent that prompted you
|
|
88
|
+
|
|
89
|
+
`SOURCE` names the local file, or `-` for standard input; `ARTIFACT_PATH` is its canonical absolute artifact path, such as `/replies/1.txt`.
|
|
90
|
+
Use a new `OPERATION_ID` for each intended publication.
|
|
91
|
+
A rerun with the same operation identifier returns that publication's saved result; it never reads the source again, so changed content needs a new identifier.
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
scripts/sp publish-file --source "$SOURCE" --path "$ARTIFACT_PATH" --operation-id "$OPERATION_ID" --ttl-seconds 600
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Copy the returned `reference` without editing its contents.
|
|
98
|
+
This command publishes a complete root containing that one file.
|
|
99
|
+
It also retains the root in the same atomic publication.
|
|
100
|
+
While you serve a prompt, it also grants the agent that prompted you read on that file: the result's `granted_to_caller` says so, and `caller_grant_error` says why not.
|
|
101
|
+
Then put the unchanged reference in your reply.
|
|
102
|
+
|
|
103
|
+
To grant that agent read again, for example after the grant expired:
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
scripts/sp grant --ref "$REFERENCE" --operation-id "$GRANT_ID" --ttl-seconds 600
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
A grant goes to the agent whose prompt you are serving, and to no one else.
|
|
110
|
+
The returned expiry can be earlier than requested because the grant cannot outlive its retained root.
|
|
111
|
+
|
|
112
|
+
## Hand a reference to another agent
|
|
113
|
+
|
|
114
|
+
Put the unchanged reference in the prompt of `prompt_agent`, and nothing
|
|
115
|
+
more: do not grant for it yourself. The agent tools grant the receiver read
|
|
116
|
+
when it reads references (`discover_agents` shows
|
|
117
|
+
`reads_scratchpad_references: true`), and take the reference out of the
|
|
118
|
+
prompt otherwise, saying so in the call's result. A reference another agent
|
|
119
|
+
handed you goes on the same way; its creator decides whether the receiver
|
|
120
|
+
may read it.
|
|
121
|
+
|
|
122
|
+
## Publish an edited directory
|
|
123
|
+
|
|
124
|
+
An external editor or executor prepares `SOURCE_DIRECTORY`.
|
|
125
|
+
ScratchPad does not run that editor or executor.
|
|
126
|
+
|
|
127
|
+
```sh
|
|
128
|
+
scripts/sp sync --source "$SOURCE_DIRECTORY" --operation-id "$OPERATION_ID"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Sync publishes the whole directory as the next root.
|
|
132
|
+
Paths absent from that directory are absent from the new root.
|
|
133
|
+
Preparation copies canonical content into a private disk spool in the workspace before upload.
|
|
134
|
+
It preserves executable file modes and literal symbolic links without following links.
|
|
135
|
+
There are no implicit Git exclusions; choose the source tree explicitly.
|
|
136
|
+
Another writer's publication can produce an explicit conflict; the command does not merge automatically.
|
|
137
|
+
|
|
138
|
+
## Resolve a failed command
|
|
139
|
+
|
|
140
|
+
| Exit | Action |
|
|
141
|
+
| ---- | ---------------------------------------------------------------------------------- |
|
|
142
|
+
| 0 | Inspect the successful JSON result. |
|
|
143
|
+
| 1 | Inspect the definite failure code and workspace state. |
|
|
144
|
+
| 2 | Correct the local arguments; no product request was sent. |
|
|
145
|
+
| 3 | The outcome is unknown. Recover the saved intent before starting another mutation. |
|
|
146
|
+
|
|
147
|
+
```sh
|
|
148
|
+
scripts/sp recover
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Recovery first reconciles an exact accepted receipt.
|
|
152
|
+
If publication remains necessary, recovery uploads the saved spool and submits the same command.
|
|
153
|
+
It never rereads a changed source file or standard input.
|
|
154
|
+
An `epoch_changed` response requires preparation against the current collection epoch; rerun recovery after maintenance ends.
|
|
155
|
+
Do not change its operation identifier, base, root, or requested retention while the outcome remains unresolved.
|
|
156
|
+
A definite conflict can leave the publication pending.
|
|
157
|
+
Inspect an explicit reset plan before abandoning that intent.
|
|
158
|
+
|
|
159
|
+
```sh
|
|
160
|
+
scripts/sp reset
|
|
161
|
+
scripts/sp reset --apply
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Reset fences the previous writer generation.
|
|
165
|
+
It does not release retention from an earlier unknown publication.
|
|
166
|
+
An unresolved grant can block further control operations until acceptance, a positive observation, or expiry settles it.
|
|
167
|
+
|
|
168
|
+
A publication refused before its checkpoint was prepared leaves its spool, and so does a publication abandoned by reset.
|
|
169
|
+
A later publication requires recovery or explicit removal of that saved upload.
|
|
170
|
+
Inspect the spool before attempting removal:
|
|
171
|
+
|
|
172
|
+
```sh
|
|
173
|
+
scripts/sp spool-inspect
|
|
174
|
+
scripts/sp spool-remove
|
|
175
|
+
scripts/sp spool-remove --apply
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Remove an unprepared upload
|
|
179
|
+
|
|
180
|
+
Removal is a dry run without `--apply` and refuses a pending checkpoint.
|
|
181
|
+
A refused upload can be removed without reset when its writer remains ready at the saved command position.
|
|
182
|
+
Inspect the removal report before applying it.
|
|
183
|
+
Removal abandons the saved upload, including bytes read from standard input.
|
|
184
|
+
Remote reservations remain charged until maintenance collects them.
|
|
185
|
+
An older workspace can already have a pending checkpoint after an upload refusal.
|
|
186
|
+
Do not automatically reset it because a response says `capacity`; recover or inspect an explicit reset first.
|
|
187
|
+
A new publication reclaims a completed previous spool only after its exact receipt is saved.
|
|
188
|
+
|
|
189
|
+
## Reclaim expired content
|
|
190
|
+
|
|
191
|
+
```sh
|
|
192
|
+
scripts/sp maintain
|
|
193
|
+
scripts/sp maintain --apply
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
The first command reports the proposed maintenance.
|
|
197
|
+
The second releases unprotected expired pins, closes the volume, traces retained dependencies, collects unreachable objects, and reopens it.
|
|
198
|
+
Maintenance does not scrub retained file payloads.
|
|
199
|
+
If interrupted, recover the saved request or repeat maintenance against the durable closed state.
|
|
200
|
+
Capacity refusal requires maintenance or an explicit operator decision; it never permits eviction of retained content.
|
|
201
|
+
|
|
202
|
+
## Capacity
|
|
203
|
+
|
|
204
|
+
Deployment scopes select explicit encoded-byte and object quotas.
|
|
205
|
+
Read this agent's configured allowances with `scripts/sp info`; example sizes are not deployment defaults.
|
|
206
|
+
Objects include chunks, file metadata, and directories.
|
|
207
|
+
Retained results and unfinished uploads consume the same allowance.
|
|
208
|
+
Replacing unique content needs room for both versions until old retention is released and collection completes.
|
|
209
|
+
Local spools also need enough private disk space for the prepared artifact.
|