@stigmer/coding-agent-plugin 0.2.0 → 0.3.1
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/README.md +150 -9
- package/index.js +2 -2
- package/package.json +2 -2
- package/plugin/.claude-plugin/marketplace.json +5 -2
- package/plugin/.claude-plugin/plugin.json +15 -4
- package/plugin/.codex-plugin/plugin.json +12 -5
- package/plugin/.cursor-plugin/marketplace.json +4 -2
- package/plugin/.cursor-plugin/plugin.json +7 -4
- package/plugin/README.md +52 -10
- package/plugin/hooks/codex-hooks.json +1 -0
- package/plugin/hooks/cursor-hooks.json +1 -0
- package/plugin/hooks/decide.mjs +230 -0
- package/plugin/hooks/guard.mjs +20 -0
- package/plugin/hooks/hooks.json +15 -0
- package/plugin/skills/stigmer/SKILL.md +244 -201
- package/plugin/skills/stigmer-build/SKILL.md +239 -0
- package/plugin/skills/stigmer-integrate/SKILL.md +227 -0
- package/plugin/skills/stigmer-operate/SKILL.md +239 -0
- package/plugin/skills/stigmer-run/SKILL.md +258 -0
- package/plugin/skills/stigmer-setup/SKILL.md +232 -0
- /package/plugin/{.claude-plugin/icon.png → assets/logo.png} +0 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stigmer-build
|
|
3
|
+
description: >
|
|
4
|
+
Designs and changes the person's Stigmer agents and connects them to
|
|
5
|
+
people: where a secret or a customer's password goes, an MCP server and
|
|
6
|
+
which tools the agent may use, a tool that waits for a person's yes,
|
|
7
|
+
packages and a locked network in its sandbox, their own skills and
|
|
8
|
+
Claude Code plugin unchanged, a chat link, Slack (theirs or a
|
|
9
|
+
customer's), WhatsApp and reminders, staff taking over, routines on a
|
|
10
|
+
schedule or started by another system. Use when the person says "where
|
|
11
|
+
does the password go", "hook up our MCP server", "only the read tools",
|
|
12
|
+
"a refund must wait for a yes", "install tesseract in its sandbox",
|
|
13
|
+
"reuse our Claude Code plugin", "customers want it in their own Slack",
|
|
14
|
+
"a WhatsApp reminder", "every Monday at 9" or "start it when Airflow
|
|
15
|
+
finishes", or asks what an agent uses before changing it. To set
|
|
16
|
+
Stigmer up, use stigmer-setup; to run an agent, stigmer-run; to call it
|
|
17
|
+
from their code or put the chat in their app, stigmer-integrate; for
|
|
18
|
+
questions about Stigmer, the stigmer skill.
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Building a Stigmer agent and connecting it to people
|
|
22
|
+
|
|
23
|
+
The person has an agent, or wants one, and needs it set up for a job: the
|
|
24
|
+
keys it uses, its tools, where it asks first, what its sandbox has, and who
|
|
25
|
+
reaches it and when. Your job is to say which piece of Stigmer does each
|
|
26
|
+
part, read that piece's page, and answer or act the way the page shows it.
|
|
27
|
+
This skill is the map and the method; the fields, commands and rules are on
|
|
28
|
+
the pages it names. Read the page before answering, cite it as a full
|
|
29
|
+
`https://stigmer.ai/docs/...` URL, and never write a field, flag or command
|
|
30
|
+
the page doesn't show.
|
|
31
|
+
|
|
32
|
+
## First, two facts
|
|
33
|
+
|
|
34
|
+
Find these before you answer or write anything.
|
|
35
|
+
|
|
36
|
+
1. **Where Stigmer runs.** `stigmer auth whoami` names the server's version
|
|
37
|
+
and edition and the Organization; `stigmer config backend status` its
|
|
38
|
+
address. Slack, WhatsApp, staff taking over conversations and roles on
|
|
39
|
+
one routine are Stigmer Cloud's (some also Enterprise's), and an
|
|
40
|
+
Environment takes effect only where the server starts sandboxes. Say
|
|
41
|
+
what needs Cloud before giving the steps; when you don't know the
|
|
42
|
+
edition, say which editions have it.
|
|
43
|
+
2. **What already exists.** `stigmer get agent <agent> -o yaml` prints the
|
|
44
|
+
live definition; the person's project may keep manifests (`stigmer/`
|
|
45
|
+
or `*.yaml` with `kind: Agent`). A change starts from the live
|
|
46
|
+
definition and keeps everything the person didn't ask to change.
|
|
47
|
+
|
|
48
|
+
## Which piece does what
|
|
49
|
+
|
|
50
|
+
Most wrong answers here invent a field. Pick the piece from this table,
|
|
51
|
+
then read its page.
|
|
52
|
+
|
|
53
|
+
| The person needs | The piece | Never | Page |
|
|
54
|
+
| --- | --- | --- | --- |
|
|
55
|
+
| A password, token or key the agent's tools use | A vault holds the value; the Agent declares the variable in `env` as a secret with no value | the instructions, a Skill, an Environment, a plain `value`, a message | https://stigmer.ai/docs/concepts/vaults, https://stigmer.ai/docs/concepts/agents |
|
|
56
|
+
| Each customer's own key under one name | A vault per customer, named on that customer's conversations, routines or channel; or an Organization per customer | one vault every customer's conversations use | https://stigmer.ai/docs/guides/authentication/customer-keys |
|
|
57
|
+
| Packages installed before work starts, and a locked-down network | An Environment (apt and pip packages, `networking`), the Agent's default or named per conversation or routine | install steps in the instructions or a Skill; keys in the Environment | https://stigmer.ai/docs/guides/environments/set-up-an-environment, https://stigmer.ai/docs/concepts/environments |
|
|
58
|
+
| A tool that waits for a person's yes | The tool's mark (an MCP tool's `destructiveHint`) or a `PreToolUse` hook that asks | a field on the Agent, or telling the model to ask | https://stigmer.ai/docs/concepts/approval-flows |
|
|
59
|
+
| Their MCP server | A plugin holding it (`stigmer mcp add`), listed in the Agent's `plugins` | a token pasted into a header | https://stigmer.ai/docs/guides/integrations/connect-an-mcp-server |
|
|
60
|
+
| Only some tools | The Agent's `tools` and `disallowed_tools`, in the full tool-name form | bare tool names | https://stigmer.ai/docs/concepts/tools |
|
|
61
|
+
| Know-how written down | A Skill (`stigmer push skill`), listed in the Agent's `skill_refs` | pasting it into the instructions | https://stigmer.ai/docs/concepts/skills |
|
|
62
|
+
| A team's Claude Code, Cursor or Codex plugin | The folder, unchanged, as a plugin (`stigmer push plugin`), listed in the Agent's `plugins` | rewriting it; its Skills in `skill_refs` | https://stigmer.ai/docs/concepts/plugins, https://stigmer.ai/docs/guides/plugins/install-a-plugin, https://stigmer.ai/docs/guides/plugins/use-hooks |
|
|
63
|
+
| A schedule, or another system starting the agent | A Routine | their own cron or a polling script as the answer | https://stigmer.ai/docs/concepts/routines |
|
|
64
|
+
| People outside Stigmer chatting with it | A Channel: a chat link, the embed, Slack or WhatsApp | a home-made bot or inbox | https://stigmer.ai/docs/concepts/channels |
|
|
65
|
+
|
|
66
|
+
## Designing the agent
|
|
67
|
+
|
|
68
|
+
### Keep a secret out of the instructions
|
|
69
|
+
|
|
70
|
+
The Agent's `env` names the variable as a secret with no value; the value
|
|
71
|
+
lives in a vault and is found by its name when a run starts, so a shell
|
|
72
|
+
command the agent runs (psql, curl) reads it as an environment variable.
|
|
73
|
+
Pages: https://stigmer.ai/docs/concepts/vaults, https://stigmer.ai/docs/concepts/agents ("Where the secrets
|
|
74
|
+
come from"), https://stigmer.ai/docs/cli/commands/vault.
|
|
75
|
+
|
|
76
|
+
- One customer, one vault, the same variable name in each; the vault is
|
|
77
|
+
named on that customer's conversations, routines or channel. In an
|
|
78
|
+
Organization several customers share, a customer's vault never gets
|
|
79
|
+
Organization visibility.
|
|
80
|
+
- An Agent carries no vaults: never invent a field for them on it.
|
|
81
|
+
- The value is saved by the person, never typed on a command line or
|
|
82
|
+
pasted into the chat: `stigmer vault set-secret` asks for it, or reads it
|
|
83
|
+
with `--from-env` from a variable they set. There is no `--value` flag.
|
|
84
|
+
|
|
85
|
+
### Attach an MCP server and limit its tools
|
|
86
|
+
|
|
87
|
+
`stigmer mcp add <name> <url>`, with a header naming a vault key
|
|
88
|
+
(`--header 'Authorization=Bearer ${NAME}'`), then list the plugin in the
|
|
89
|
+
Agent's `plugins`. Limit it in `tools`, in the form the page gives for that
|
|
90
|
+
route (`mcp__plugin_<plugin>_<server>__<tool>`; a hyphen in the name stays).
|
|
91
|
+
Page: https://stigmer.ai/docs/guides/integrations/connect-an-mcp-server.
|
|
92
|
+
|
|
93
|
+
- A parenthesised specifier never narrows a tool to some calls.
|
|
94
|
+
|
|
95
|
+
### Make a tool wait for a person's yes
|
|
96
|
+
|
|
97
|
+
Approval comes from the tool, not the Agent: their MCP server marks the
|
|
98
|
+
tool `destructiveHint: true`, or a `PreToolUse` hook asks before it; read
|
|
99
|
+
tools stay unmarked. The run then waits, durably, until someone allows or
|
|
100
|
+
denies the call. Page: https://stigmer.ai/docs/concepts/approval-flows.
|
|
101
|
+
|
|
102
|
+
- Never recommend approving every call (`auto_approve_all`, **Allow all**)
|
|
103
|
+
as the setup.
|
|
104
|
+
- On Slack, WhatsApp or a chat link nobody can approve: a call that asks is
|
|
105
|
+
skipped there, and the customer never sees a prompt.
|
|
106
|
+
|
|
107
|
+
### Packages and a locked-down network
|
|
108
|
+
|
|
109
|
+
An Environment lists apt and pip packages, installed before the first turn
|
|
110
|
+
of every fresh sandbox, and its `networking` limits the hosts. Make it the
|
|
111
|
+
Agent's default Environment, or name it per conversation or routine.
|
|
112
|
+
Pages: https://stigmer.ai/docs/guides/environments/set-up-an-environment, https://stigmer.ai/docs/concepts/environments.
|
|
113
|
+
|
|
114
|
+
- Packages under limited networking need the package registries allowed
|
|
115
|
+
too, and that opens them to the agent: say so, for the security team.
|
|
116
|
+
- An Environment holds no keys.
|
|
117
|
+
|
|
118
|
+
### Bring their own skills and plugin
|
|
119
|
+
|
|
120
|
+
A Claude Code, Cursor or Codex plugin folder works unchanged, its skills
|
|
121
|
+
and its `hooks.json` included: an Organization admin pushes it
|
|
122
|
+
(`stigmer push plugin <dir>`, or the console), and the Agent lists it in
|
|
123
|
+
`plugins`, which brings its Skills and hooks with it. A loose skill folder
|
|
124
|
+
is pushed the same way, by an admin (`stigmer push skill <dir>`), and
|
|
125
|
+
listed in `skill_refs`.
|
|
126
|
+
Pages: https://stigmer.ai/docs/guides/plugins/install-a-plugin, https://stigmer.ai/docs/guides/plugins/use-hooks.
|
|
127
|
+
|
|
128
|
+
- Only `PreToolUse` and `PostToolUse` command hooks run; the plugin's page
|
|
129
|
+
lists the rest as not run. Hooks in the repository's `.claude/settings.json`
|
|
130
|
+
never run for the Agent.
|
|
131
|
+
- A hook's paths are the sandbox's: a rule about `/reports` is written
|
|
132
|
+
against `$CLAUDE_PROJECT_DIR`.
|
|
133
|
+
|
|
134
|
+
### See what an agent uses now
|
|
135
|
+
|
|
136
|
+
`stigmer get agent <agent> -o yaml`, then `stigmer get skill <skill> -o yaml`
|
|
137
|
+
for each skill it lists (or the `get_agent` and `get_skill` tools). Report
|
|
138
|
+
what you read from their Stigmer, not what the docs say an agent usually
|
|
139
|
+
has. When the person asked only to look, change nothing.
|
|
140
|
+
|
|
141
|
+
## Connecting it to people
|
|
142
|
+
|
|
143
|
+
### A chat link or the embed
|
|
144
|
+
|
|
145
|
+
`stigmer channel link <agent>` makes the hosted chat link (its audience is
|
|
146
|
+
the Organization's members unless they choose `--audience public`). The
|
|
147
|
+
chat inside their own app is the stigmer-integrate skill's job.
|
|
148
|
+
Pages: https://stigmer.ai/docs/guides/channels/create-a-chat-link, https://stigmer.ai/docs/guides/channels/embed-an-agent.
|
|
149
|
+
|
|
150
|
+
### Slack
|
|
151
|
+
|
|
152
|
+
An Organization admin adds a Slack channel on the Agent (**Add channel →
|
|
153
|
+
Slack**), which installs the bot into one workspace; the bot answers as
|
|
154
|
+
**Stigmer** unless they connect through their own Slack app. Each
|
|
155
|
+
customer's workspace gets its own channel on the Agent, with a vault of
|
|
156
|
+
that customer's keys; one app serves every workspace. The page says who
|
|
157
|
+
must finish a customer's install. Stigmer Cloud only.
|
|
158
|
+
Pages: https://stigmer.ai/docs/guides/channels/connect-slack, https://stigmer.ai/docs/guides/channels/bring-your-own-slack-app.
|
|
159
|
+
|
|
160
|
+
- There is no self-install link a customer opens alone, no Slack App
|
|
161
|
+
Directory listing, and no CLI command that installs Slack.
|
|
162
|
+
- Tell the person why each customer's channel needs its own vault: a
|
|
163
|
+
channel's conversations have no signed-in person, so its tools take keys
|
|
164
|
+
only from the vaults attached to that channel, never anyone's own vault.
|
|
165
|
+
|
|
166
|
+
### WhatsApp, with reminders
|
|
167
|
+
|
|
168
|
+
Their own Meta app, registered in Stigmer, and a WhatsApp channel on the
|
|
169
|
+
Agent: replies first. For a reminder, tell the person both rules and why:
|
|
170
|
+
WhatsApp delivers free-form text only within 24 hours of the person's last
|
|
171
|
+
message, so a reminder is a template approved in WhatsApp Manager, sent
|
|
172
|
+
once the channel's proactive messaging is on; and the sweep is a scheduled
|
|
173
|
+
routine whose message finds who is due and sends the template, because a
|
|
174
|
+
routine's run may message anyone while a member's own conversation only
|
|
175
|
+
answers them. Stigmer Cloud only.
|
|
176
|
+
Pages: https://stigmer.ai/docs/guides/channels/set-up-your-meta-app, https://stigmer.ai/docs/guides/channels/connect-whatsapp,
|
|
177
|
+
https://stigmer.ai/docs/guides/channels/send-proactive-messages-with-templates.
|
|
178
|
+
|
|
179
|
+
- Templates are written in Meta's tools, never in Stigmer.
|
|
180
|
+
- Meta bills templates, and replies past its free tier: the page says what
|
|
181
|
+
the Meta account needs.
|
|
182
|
+
|
|
183
|
+
### Staff take over a conversation
|
|
184
|
+
|
|
185
|
+
In the console's **Conversations**, a person with **Participant** on the
|
|
186
|
+
channel takes a conversation over, replies through the same number, and
|
|
187
|
+
hands it back. WhatsApp only today; on Slack staff read, and only the
|
|
188
|
+
Agent replies. Page: https://stigmer.ai/docs/guides/channels/take-over-conversations.
|
|
189
|
+
|
|
190
|
+
### A routine on a schedule
|
|
191
|
+
|
|
192
|
+
A `kind: Routine` manifest (or the console's **New routine**): the Agent,
|
|
193
|
+
the message every run starts from, a `cron` and its `time_zone`, the vaults
|
|
194
|
+
its tools need (no one is signed in when it runs) and, if it needs one, an
|
|
195
|
+
Environment. Applied with `stigmer apply -f <file>`: `stigmer routine`
|
|
196
|
+
has no command that creates one. Page: https://stigmer.ai/docs/guides/routines/run-an-agent-on-a-schedule.
|
|
197
|
+
|
|
198
|
+
- A routine is created off. Turning it on, or **Enable & run now**, starts
|
|
199
|
+
runs that spend the Organization's model keys: ask first, and leave it
|
|
200
|
+
off unless the person said to turn it on.
|
|
201
|
+
- What a run makes is a File of the run, downloaded from the conversation
|
|
202
|
+
or with `stigmer download run`; Stigmer doesn't email it.
|
|
203
|
+
|
|
204
|
+
### A routine another system starts
|
|
205
|
+
|
|
206
|
+
A routine with no `cron`, whose message tells the Agent to use the note;
|
|
207
|
+
the other system sends one HTTP call with the routine's id and a note,
|
|
208
|
+
using a service account's key kept in its secret store. Every run acts as
|
|
209
|
+
the routine's owner, never the caller: to keep it off a person's login, the
|
|
210
|
+
service account creates and owns the routine. Pages:
|
|
211
|
+
https://stigmer.ai/docs/guides/routines/start-a-routine-from-another-system, https://stigmer.ai/docs/concepts/routines.
|
|
212
|
+
|
|
213
|
+
- The request takes the routine's `id` and the note's `text`, nothing else;
|
|
214
|
+
there is no per-routine webhook URL.
|
|
215
|
+
- A note can tell the Agent what happened; it can't change what the routine
|
|
216
|
+
asks.
|
|
217
|
+
|
|
218
|
+
## Acting for the person
|
|
219
|
+
|
|
220
|
+
When the person asks you to make the change, not only to explain it:
|
|
221
|
+
|
|
222
|
+
- Write it as a manifest in their project (next to the ones they keep) and
|
|
223
|
+
apply it with `stigmer apply -f <file>`. For an Agent that already
|
|
224
|
+
exists, start from `stigmer get agent <agent> -o yaml`, change only what
|
|
225
|
+
they asked, show the change, and say it replaces the live version before
|
|
226
|
+
applying it. `stigmer apply -f <file> --dry-run` checks the file's
|
|
227
|
+
shape on this machine only; the server may still refuse what it can't
|
|
228
|
+
serve (an Environment's packages where its sandboxes can't install
|
|
229
|
+
them). Say what it refused, in its words, and never drop part of the
|
|
230
|
+
ask to get past it.
|
|
231
|
+
- A secret is saved by the person (`stigmer vault set-secret`, which asks
|
|
232
|
+
for it) or from a variable they set (`--from-env`); its value never
|
|
233
|
+
appears in this chat or in a file you write.
|
|
234
|
+
- Turning on a routine or a channel spends the Organization's model keys:
|
|
235
|
+
propose it, and act on their yes.
|
|
236
|
+
- Read back what you made (`stigmer get routine <routine>`,
|
|
237
|
+
`stigmer get environment <environment>`, `stigmer get agent <agent>`)
|
|
238
|
+
and tell them which files you wrote and what is left for them to do (a
|
|
239
|
+
Slack install, a Meta app, a template's approval).
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stigmer-integrate
|
|
3
|
+
description: >
|
|
4
|
+
Puts the person's Stigmer agent into their own product, whatever their
|
|
5
|
+
stack: calls it from their backend (TypeScript, Python, Go or Java),
|
|
6
|
+
streams its reply to their page, puts the chat in their React app and
|
|
7
|
+
makes it wear their brand, signs their users in (their own sign-in,
|
|
8
|
+
Auth0, Okta, Clerk), decides whose conversation a run becomes, walls
|
|
9
|
+
each business customer off in an organization of its own, answers
|
|
10
|
+
approvals in their own screens, and moves code off Claude Managed
|
|
11
|
+
Agents. Use when the person says "call our agent from our backend",
|
|
12
|
+
"when a customer uploads X, run the agent on it", "stream the reply to
|
|
13
|
+
the page", "put the chat in our app", "make it look like us", "our
|
|
14
|
+
users are signed in with Auth0", "each customer must be separate",
|
|
15
|
+
"approve in our own dashboard" or "we're on Claude Managed Agents". To
|
|
16
|
+
set Stigmer up first, use the stigmer-setup skill; to run an agent or
|
|
17
|
+
read its runs, the stigmer-run skill; for questions about Stigmer
|
|
18
|
+
itself, the stigmer skill.
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Putting a Stigmer agent in the person's product
|
|
22
|
+
|
|
23
|
+
The person has an app with its own users and wants a Stigmer agent working
|
|
24
|
+
inside it. Your job is the integration: the code in their repository that
|
|
25
|
+
calls Stigmer, in their language, the way the docs show it. This skill is
|
|
26
|
+
the map and the method; the calls themselves are on the docs pages it names,
|
|
27
|
+
with a tab per language. Read the page for their stack before writing a
|
|
28
|
+
line, cite it as a full `https://stigmer.ai/docs/...` URL, and write the
|
|
29
|
+
code the page shows, never an API you expect to exist.
|
|
30
|
+
|
|
31
|
+
## First, three facts about their app
|
|
32
|
+
|
|
33
|
+
Find these before you answer or write anything. Each one changes the code.
|
|
34
|
+
|
|
35
|
+
1. **The stack.** Read the repository: `package.json` (Next.js, Express,
|
|
36
|
+
React), `pyproject.toml` or `requirements.txt` (FastAPI, Django),
|
|
37
|
+
`go.mod`, `pom.xml` or `build.gradle`. The backend's language picks the
|
|
38
|
+
SDK; the frontend's picks the chat (the chat is React).
|
|
39
|
+
2. **Where Stigmer runs**: Stigmer Cloud, their own server, or `stigmer up`
|
|
40
|
+
on this machine. `stigmer auth whoami` names the server's version and
|
|
41
|
+
edition, the Organization and, on a newer CLI, the address (`Endpoint`);
|
|
42
|
+
on an older CLI, `stigmer config backend status` gives the address. The
|
|
43
|
+
app's backend talks to that same server and Organization: put that
|
|
44
|
+
address in its settings (an `http://` or loopback address takes the
|
|
45
|
+
SDK's plaintext option), never a guessed `localhost:7234`, and never
|
|
46
|
+
start a server (`stigmer up`) to make the app work. On an older CLI,
|
|
47
|
+
`stigmer status` reports only a stack `stigmer up` runs on this machine:
|
|
48
|
+
"not running" there says nothing about the server the CLI is signed in
|
|
49
|
+
to. Federation and child organizations are served by Stigmer Cloud and
|
|
50
|
+
the Enterprise edition, not by the open-source server: never recommend
|
|
51
|
+
either before you know which they run, and when you don't, say which
|
|
52
|
+
editions have it.
|
|
53
|
+
3. **How their users sign in**: their own sessions, or an OIDC provider
|
|
54
|
+
(Auth0, Okta, Entra ID, Cognito). Read their auth code to find how a
|
|
55
|
+
request names the signed-in user.
|
|
56
|
+
|
|
57
|
+
Then check what their installed SDK has before you write against it:
|
|
58
|
+
`npm ls @stigmer/client`, `pip show stigmer-sdk`, the `go.stigmer.ai/sdk`
|
|
59
|
+
line in `go.mod`, the `stigmer-sdk` dependency in their build file. The
|
|
60
|
+
docs follow Stigmer's newest code: when a page shows something their
|
|
61
|
+
installed SDK lacks, say it is newer than their version and that upgrading
|
|
62
|
+
brings it.
|
|
63
|
+
|
|
64
|
+
## Whose run is it
|
|
65
|
+
|
|
66
|
+
Decide this before any backend code: every job below rests on it.
|
|
67
|
+
|
|
68
|
+
| Who the run belongs to | When | How | Page |
|
|
69
|
+
| --- | --- | --- | --- |
|
|
70
|
+
| Their app's own account | Work with no person behind it (a nightly job, an import) | A service account's API key on the backend | https://stigmer.ai/docs/guides/authentication/service-accounts |
|
|
71
|
+
| The signed-in user, from the browser | The user chats in the app | A token minted per user by the backend, or federation where their sign-in is OIDC (Cloud and Enterprise) | https://stigmer.ai/docs/guides/authentication/product-users, https://stigmer.ai/docs/guides/authentication/federation/overview |
|
|
72
|
+
| The signed-in user, from the backend | The backend starts work the user owns (a run on their upload) | A second client on a token minted for the user, kept in a token cache | https://stigmer.ai/docs/guides/authentication/product-users ("From your backend, as the user") |
|
|
73
|
+
| A business customer, walled off | Customers must never see each other's conversations, files or keys | An organization per customer, people landing there by minted token or federation | https://stigmer.ai/docs/getting-started/one-organization-per-customer |
|
|
74
|
+
|
|
75
|
+
Tell the person which you chose and why, with the rule behind it, in their
|
|
76
|
+
answer: a run started with the service account's key is the service
|
|
77
|
+
account's (the customer does not own it, and their chat does not show it); it
|
|
78
|
+
is the customer's only when started on a token minted for them, or inside an
|
|
79
|
+
organization of their own. A conversation is private to whoever started it,
|
|
80
|
+
so read a user's run (its answer, its files) with that user's client, never
|
|
81
|
+
the service account's.
|
|
82
|
+
|
|
83
|
+
## The keys
|
|
84
|
+
|
|
85
|
+
- The service account's key lives on the backend only, in an environment
|
|
86
|
+
variable read at startup, in an env file that is git-ignored. Never in
|
|
87
|
+
browser code, a `NEXT_PUBLIC_` variable, a mobile app or a commit.
|
|
88
|
+
- Minting tokens needs a service account with the **admin** role.
|
|
89
|
+
Creating child organizations needs an admin's own key: a service
|
|
90
|
+
account's key cannot create organizations.
|
|
91
|
+
- A key never passes through you: the CLI writes it into the env file and
|
|
92
|
+
prints only where it went. When the app needs one, make it as the
|
|
93
|
+
stigmer-setup skill's step 6 does, telling the person what you are making:
|
|
94
|
+
`stigmer service-account list`, and use the app's admin account if one
|
|
95
|
+
exists (never make a second without asking), otherwise
|
|
96
|
+
`stigmer service-account create app-backend --role admin`; check the env
|
|
97
|
+
file is git-ignored (`git check-ignore <file>`), then
|
|
98
|
+
`stigmer apikey create --service-account app-backend --name <the app's name> --save-to-env <file>`.
|
|
99
|
+
Never print the file, and never ask the person to paste a key.
|
|
100
|
+
|
|
101
|
+
## The jobs
|
|
102
|
+
|
|
103
|
+
Each job names its pages; read the one for their stack whole before
|
|
104
|
+
writing. The pitfalls are the mistakes this job draws.
|
|
105
|
+
|
|
106
|
+
### Run the agent from their backend on a file
|
|
107
|
+
|
|
108
|
+
A customer uploads a file; the backend runs the agent on it, waits, and keeps
|
|
109
|
+
what it made. Upload the file, send the message with its id and wait for the
|
|
110
|
+
turn (`sendAndWait` and its counterpart in each SDK), then list the run's
|
|
111
|
+
output files by run id and download each. Pages: https://stigmer.ai/docs/getting-started/call-from-your-app
|
|
112
|
+
(TypeScript, start to finish), then https://stigmer.ai/docs/sdk/typescript, https://stigmer.ai/docs/sdk/python,
|
|
113
|
+
https://stigmer.ai/docs/sdk/go or https://stigmer.ai/docs/sdk/java, and https://stigmer.ai/docs/concepts/files.
|
|
114
|
+
|
|
115
|
+
- The report is a File the run made: fetch it from the run's outputs. Never
|
|
116
|
+
parse it out of the agent's chat text.
|
|
117
|
+
- No webhook tells the backend a run finished: the backend waits for the
|
|
118
|
+
turn, or follows its stream.
|
|
119
|
+
- Decide whose run it is first (above). For the customer's own, the upload,
|
|
120
|
+
the run and the reads all go through the client on the customer's token.
|
|
121
|
+
|
|
122
|
+
### Stream the reply to their page
|
|
123
|
+
|
|
124
|
+
Start the turn without waiting (`startTurn` in TypeScript, `run.create`
|
|
125
|
+
elsewhere), follow the Session's events from the start, relay the agent's
|
|
126
|
+
message text as it comes (server-sent events, a streaming response), and
|
|
127
|
+
stop when the run's status event says it ended. Page: https://stigmer.ai/docs/sdk/streaming
|
|
128
|
+
("Follow a run", "Detect the end of a run", "Resume a dropped stream").
|
|
129
|
+
|
|
130
|
+
- Keep only the events of this run, and the agent's own (no sub-agent
|
|
131
|
+
thread), as the page does.
|
|
132
|
+
|
|
133
|
+
### Put the chat in their React app
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
stigmer app-handover --stack <nextjs|node|python|go|java> --agent <agent> --write .
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
It writes the backend's token route and the chat component from the same
|
|
140
|
+
writer the console uses, and says what to install. Then fit them to the
|
|
141
|
+
app: the route's `currentUser` becomes their own session read, the chat goes
|
|
142
|
+
on the page where their users would use the agent, and
|
|
143
|
+
`stigmer embedding set --create-accounts-on-sign-in on --sign-in-role member`
|
|
144
|
+
makes a user's Stigmer account the first time the app signs them in. The
|
|
145
|
+
first chat in a new project is the stigmer-setup skill's step 6; this is the
|
|
146
|
+
same work in an app that already exists. Pages: https://stigmer.ai/docs/cli/commands/app-handover,
|
|
147
|
+
https://stigmer.ai/docs/getting-started/embed-agent, https://stigmer.ai/docs/guides/authentication/product-users.
|
|
148
|
+
|
|
149
|
+
- Users already signed in through Auth0 or another OIDC provider: minted
|
|
150
|
+
tokens work on every edition that signs callers in; federation (the
|
|
151
|
+
browser sends the provider's token itself) is Cloud and Enterprise only.
|
|
152
|
+
Lay out both when you don't know the edition.
|
|
153
|
+
- `viewer` as the sign-in role can't start conversations; `member` can.
|
|
154
|
+
- Allowed origins in the embedding settings restrict which pages may use
|
|
155
|
+
the tokens.
|
|
156
|
+
|
|
157
|
+
### Make the chat wear their brand
|
|
158
|
+
|
|
159
|
+
Their colours, font and dark mode go on a theme class that overrides the
|
|
160
|
+
`--stgm-*` tokens, applied through `StigmerProvider`; dark mode follows
|
|
161
|
+
their own toggle through `colorMode`, and every token they override needs a
|
|
162
|
+
dark value too. Parts of the chat (the approval card, message rows) are
|
|
163
|
+
replaced through slots (`threadSlots` on `AgentChat`), each receiving the
|
|
164
|
+
built-in's props; a chat in markup entirely their own is built from the
|
|
165
|
+
`@stigmer/react-core` hooks. Pages: https://stigmer.ai/docs/sdk/theme/theming, https://stigmer.ai/docs/sdk/theme/presets,
|
|
166
|
+
https://stigmer.ai/docs/sdk/theme/tokens, https://stigmer.ai/docs/sdk/react-core/build-a-chat.
|
|
167
|
+
|
|
168
|
+
- Never override the kit's internal class names, use `!important`, or fork
|
|
169
|
+
the kit: tokens and slots are the contract.
|
|
170
|
+
- Their page loads their font itself; the token only names it.
|
|
171
|
+
|
|
172
|
+
### One organization per business customer
|
|
173
|
+
|
|
174
|
+
Each customer gets a child organization of the person's own, made by their
|
|
175
|
+
onboarding code at sign-up (an admin's own key, never a service account's).
|
|
176
|
+
The agent stays in the parent and is shared with its children, so every
|
|
177
|
+
customer, including later ones, runs it inside their own organization. Their
|
|
178
|
+
people land in it by a token the backend mints into that child, or by
|
|
179
|
+
federation routing each token to the child whose external id matches.
|
|
180
|
+
Pages: https://stigmer.ai/docs/getting-started/one-organization-per-customer,
|
|
181
|
+
https://stigmer.ai/docs/guides/authentication/federation/child-organizations,
|
|
182
|
+
https://stigmer.ai/docs/concepts/organizations.
|
|
183
|
+
|
|
184
|
+
- Labels, naming conventions or their own filtering inside one organization
|
|
185
|
+
do not wall customers off.
|
|
186
|
+
- Never copy the agent into each child: share it.
|
|
187
|
+
- On the open-source server, a customer's keys live in a vault of their own
|
|
188
|
+
instead (https://stigmer.ai/docs/guides/authentication/customer-keys).
|
|
189
|
+
|
|
190
|
+
### Approvals answered in their own screens
|
|
191
|
+
|
|
192
|
+
The agent asks before a call because the tool is marked (an MCP tool marked
|
|
193
|
+
`destructiveHint: true` asks by default) or a hook asks; the agent's
|
|
194
|
+
instructions alone never guarantee a person's yes. The backend learns a call
|
|
195
|
+
is waiting from the turn's outcome (`sendAndWait` or `waitForTurn` returning
|
|
196
|
+
`waiting` with its asks) or the attention stream, shows it in their own
|
|
197
|
+
screen, and answers with the tool use's id (`confirmToolUse`, allow or deny);
|
|
198
|
+
the run then carries on. Pages: https://stigmer.ai/docs/concepts/approval-flows, https://stigmer.ai/docs/sdk/streaming
|
|
199
|
+
("Answer a call that waits", "Know when a conversation needs you").
|
|
200
|
+
|
|
201
|
+
- There is no approval webhook and no approval callback: the backend reads
|
|
202
|
+
the turn or the stream.
|
|
203
|
+
- Never suggest approving every call (`autoApproveAll`) for calls that need a
|
|
204
|
+
person.
|
|
205
|
+
|
|
206
|
+
### Moving from Claude Managed Agents
|
|
207
|
+
|
|
208
|
+
Say what carries over and what doesn't, from the pages. Pages:
|
|
209
|
+
https://stigmer.ai/docs/concepts/coming-from-claude-managed-agents, https://stigmer.ai/docs/sdk/managed-agents.
|
|
210
|
+
|
|
211
|
+
- Their event code carries over: Anthropic's SDK pointed at Stigmer's
|
|
212
|
+
address with a Stigmer key lists, streams and answers a Session's events,
|
|
213
|
+
tool confirmations included.
|
|
214
|
+
- Creating Sessions does not: they are created through Stigmer's SDK or
|
|
215
|
+
console, and their ids then used with Anthropic's SDK.
|
|
216
|
+
- Custom tools have no counterpart (Stigmer runs every tool; serve it from
|
|
217
|
+
an MCP server), and neither do outcomes (Scores grade a finished run).
|
|
218
|
+
- Name only the SDK versions the page names as tested.
|
|
219
|
+
|
|
220
|
+
## Before calling it done
|
|
221
|
+
|
|
222
|
+
Run what you wrote, the way the setup guide's step 6 ends: start the app (or
|
|
223
|
+
the script), go through the path once (one upload, one message, one
|
|
224
|
+
approval), and show the person what came back. When something can't run
|
|
225
|
+
here (no key yet, a provider they haven't connected), say exactly what is
|
|
226
|
+
left and who does it. Then tell them which files you changed and where the
|
|
227
|
+
key lives.
|