@yottagraph-app/aether-instructions 1.1.31 → 1.1.33

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.
@@ -246,21 +246,26 @@ workflow — ask before pushing directly to main in that case.
246
246
 
247
247
  ## Step 8: Deploy Agents and Next Steps
248
248
 
249
- If the app includes agents in `agents/`, offer to deploy them now:
249
+ If the app includes agents in `agents/`, **deploy them automatically** —
250
+ don't ask for confirmation. Run `/deploy_agent` for each agent immediately
251
+ after pushing. The brief asked you to build an app with agents; deploying
252
+ them is part of delivering a working app.
250
253
 
251
- > Your app is built! I see you have an agent in `agents/`. Want me to
252
- > deploy it now? I can run the deployment for you.
254
+ **Skip `example_agent`** this is a template placeholder, not a real
255
+ agent. Only deploy agents you actually built for this project.
253
256
 
254
- If the user agrees (or if this is an automated build), run `/deploy_agent`
255
- to deploy each agent. Don't just tell the user to type the command do it
256
- for them.
257
+ After triggering deployment, monitor it yourself (see `/deploy_agent`
258
+ Step 6 for how to poll). Only escalate to the user if deployment fails
259
+ and you can't resolve it.
260
+
261
+ If DESIGN.md explicitly says NOT to deploy, or says to wait for user
262
+ confirmation, respect that. Otherwise, deploy without asking.
257
263
 
258
264
  Then present next steps:
259
265
 
260
266
  > Here's what you can do next:
261
267
  >
262
- > - **Preview locally** with `npm run dev`
263
- > - **Push to deploy** -- Vercel auto-deploys on push to main
264
- > - **Deploy agents** -- I can deploy them for you, or use the Deploy
265
- > button on the Broadchurch portal's project page
266
- > - **Deploy MCP servers** -- same as above, from the portal or ask me
268
+ > - **Preview the app** Vercel auto-deployed on push to main
269
+ > - **Agents are deploying** I triggered deployment; it typically
270
+ > takes 2-5 minutes. I'll let you know when they're registered.
271
+ > - **MCP servers** — deploy from the Broadchurch portal or ask me
@@ -4,7 +4,7 @@ Deploy an ADK agent from the `agents/` directory to Vertex AI Agent Engine via t
4
4
 
5
5
  ## Overview
6
6
 
7
- This command deploys a Python ADK agent by triggering a GitHub Actions workflow through the Portal API. No local GCP credentials are needed -- the workflow authenticates via Workload Identity Federation.
7
+ This command deploys a Python ADK agent by triggering a Cloud Build job through the Portal API. No local GCP credentials are needed Cloud Build authenticates via the project's service account.
8
8
 
9
9
  The agent must live in `agents/<name>/` with the standard ADK structure (`agent.py`, `__init__.py`, `requirements.txt`).
10
10
 
@@ -56,9 +56,13 @@ ls -d agents/*/
56
56
 
57
57
  Stop here.
58
58
 
59
- **If multiple agents exist:** Ask the user which one to deploy.
59
+ **Skip `example_agent`** this is a template placeholder and should
60
+ never be deployed. Filter it out before proceeding.
60
61
 
61
- **If only one agent exists:** Confirm with the user.
62
+ **If multiple agents remain:** Deploy all of them. If called interactively
63
+ (not from `/build_my_app`), ask the user which one to deploy.
64
+
65
+ **If only one agent remains:** Proceed with it — no confirmation needed.
62
66
 
63
67
  **Important:** Agent directory names must use underscores, not hyphens (e.g., `my_agent` not `my-agent`).
64
68
 
@@ -110,35 +114,88 @@ curl -sf -X POST "<GATEWAY_URL>/api/projects/<ORG_ID>/deploy" \
110
114
 
111
115
  **If this fails with 404:** The agent directory may not exist on GitHub yet. Push your code first.
112
116
 
113
- **If this succeeds:** The Portal has triggered the `deploy-agent.yml` GitHub Actions workflow.
117
+ **If this succeeds:** The response will look like:
118
+
119
+ ```json
120
+ {
121
+ "ok": true,
122
+ "method": "cloud-build",
123
+ "build_id": "...",
124
+ "log_url": "https://console.cloud.google.com/cloud-build/builds/...",
125
+ "target": "agents/<name>",
126
+ "repo": "<owner>/<repo>"
127
+ }
128
+ ```
129
+
130
+ Save the `build_id` — you'll need it for monitoring.
114
131
 
115
132
  ---
116
133
 
117
- ## Step 6: Monitor Progress
134
+ ## Step 6: Monitor Progress and Confirm Registration
118
135
 
119
- > Deployment triggered! The agent is being deployed via GitHub Actions.
120
- >
121
- > - **Agent:** <name>
122
- > - **Workflow:** deploy-agent.yml
123
- >
124
- > This typically takes 2-5 minutes. You can monitor progress:
125
- >
126
- > - In the Broadchurch Portal under your project's Deployment Status section
127
- > - On GitHub: `https://github.com/<REPO>/actions`
128
- >
129
- > Once complete, the agent will automatically appear in your app's `/chat` page.
136
+ Deployment uses Cloud Build and typically takes 2-5 minutes. Monitor it
137
+ yourself rather than asking the user to check.
138
+
139
+ ### 6a. Poll build status
140
+
141
+ Use the deploy-status endpoint to check whether the build has finished:
142
+
143
+ ```bash
144
+ curl -sf "<GATEWAY_URL>/api/projects/<ORG_ID>/deploy-status" | jq '.cloud_builds[]'
145
+ ```
146
+
147
+ Each build entry has a `status` field. Terminal statuses are: `SUCCESS`,
148
+ `FAILURE`, `CANCELLED`, `TIMEOUT`, `INTERNAL_ERROR`, `EXPIRED`.
149
+
150
+ Poll every 30 seconds until the build reaches a terminal status (up to
151
+ 5 minutes). If it's still running after 5 minutes, tell the user and
152
+ share the `log_url` from the deploy response.
153
+
154
+ ### 6b. Confirm agent registration
155
+
156
+ A successful build doesn't guarantee the agent is usable yet — it also
157
+ needs to be registered with the tenant config. Poll the config endpoint
158
+ until the agent appears:
159
+
160
+ ```bash
161
+ curl -sf "<GATEWAY_URL>/api/config/<ORG_ID>" | jq '.agents'
162
+ ```
163
+
164
+ Check that the `agents` array contains an entry whose name matches your
165
+ agent. Poll every 30 seconds for up to 3 minutes after the build
166
+ succeeds.
167
+
168
+ ### 6c. Report result
169
+
170
+ **If the agent appears in config:**
171
+
172
+ > Agent `<name>` is deployed and registered. It should now be available
173
+ > in the app's chat interface.
174
+
175
+ **If the build succeeded but the agent doesn't appear in config after
176
+ 3 minutes:**
177
+
178
+ > The Cloud Build job succeeded, but the agent hasn't appeared in the
179
+ > tenant config yet. This may indicate the registration step failed
180
+ > silently. Check the build logs: <log_url>
181
+
182
+ **If the build failed:**
183
+
184
+ > Agent deployment failed with status `<status>`. Check the build logs
185
+ > for details: <log_url>
130
186
 
131
187
  ---
132
188
 
133
189
  ## Troubleshooting
134
190
 
135
- ### Deployment workflow fails
191
+ ### Cloud Build fails
136
192
 
137
- Check the GitHub Actions logs for the `Deploy Agent` workflow. Common issues:
193
+ Check the build logs at the `log_url` returned by the deploy endpoint.
194
+ Common issues:
138
195
 
139
196
  - **"agent.py does not export root_agent"**: Ensure your agent module defines `root_agent`.
140
197
  - **"Module not found"**: All dependencies must be in the agent's `requirements.txt`.
141
- - **WIF auth failure**: The Broadchurch admin needs to run the WIF setup script (`portal/scripts/setup-wif.sh`).
198
+ - **Service account permissions**: The Broadchurch admin may need to verify the project's service account has the required IAM roles.
142
199
 
143
200
  ### Agent directory naming
144
201
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yottagraph-app/aether-instructions",
3
- "version": "1.1.31",
3
+ "version": "1.1.33",
4
4
  "description": "Cursor rules, commands, and skills for Aether development",
5
5
  "files": [
6
6
  "rules",
package/rules/aether.mdc CHANGED
@@ -8,13 +8,13 @@ alwaysApply: true
8
8
 
9
9
  **Structure:** `pages/` (file-based routing), `components/`, `composables/`, `server/api/`, `agents/` (Python ADK), `mcp-servers/` (Python FastMCP).
10
10
 
11
- **Data:** This app runs on the Lovelace platform -- entities, news, filings, sentiment, relationships, events. See the `data` rule for access patterns and gotchas. Skill docs: `skills/data-model/` (entity types, properties, relationships; `SKILL.md` first). Do NOT call external APIs for data the platform provides.
11
+ **Data:** This app runs on the Lovelace platform -- entities, news, filings, sentiment, relationships, events. See the `data` rule for access patterns and gotchas. Skill docs: `skills/data-model/` (entity types, properties, relationships; `SKILL.md` first), `skills/elemental-mcp-patterns/` (MCP response shapes, property type handling, Python patterns for agent tools). Do NOT call external APIs for data the platform provides.
12
12
 
13
13
  **Storage:** KV (Upstash Redis) for preferences and lightweight state via `Pref<T>` from `usePrefsStore()`. Neon Postgres for relational data if connected (check `.env` for `DATABASE_URL`).
14
14
 
15
15
  **Source of truth:** `DESIGN.md` -- read before starting work, update when changing features. The starter UI is placeholder -- replace freely. Feature docs in `design/` for implementation planning.
16
16
 
17
- **Git:** Commit meaningful units of work. Run `npm run format` before commit. Message format: `[Agent commit] {summary}`.
17
+ **Git:** Commit meaningful units of work. Run `npm run format` before commit. Message format: `[Agent commit] {summary}`. Push directly to main — do NOT create PRs or feature branches.
18
18
 
19
19
  **First action for a new project:** Run `/build_my_app`.
20
20
 
@@ -70,3 +70,46 @@ In production, all Elemental API calls go through the Portal Gateway at
70
70
  `{gateway_url}/api/qs/{org_id}/...`. The agent sends `X-Api-Key` (from
71
71
  `broadchurch.yaml`) and the portal injects its own Auth0 M2M token
72
72
  upstream.
73
+
74
+ ## MCP-based agents
75
+
76
+ When the project uses **MCP-only data architecture**, agents access the
77
+ knowledge graph through Elemental MCP tools instead of REST. The MCP tools
78
+ (`elemental_get_entity`, `elemental_get_related`, `elemental_get_events`,
79
+ etc.) handle entity resolution, NEID formatting, and schema lookups
80
+ automatically. Use the `data-model` skill docs for entity types,
81
+ properties, and relationship schemas.
82
+
83
+ Wire MCP into ADK agents by declaring an `McpToolset` that points to the
84
+ Elemental MCP server. The MCP server URL and auth are configured in the
85
+ agent's runtime environment (typically via `broadchurch.yaml` gateway
86
+ proxy). See the Aether `agents` rule for ADK agent structure.
87
+
88
+ **Read the `elemental-mcp-patterns` skill** (`skills/elemental-mcp-patterns/`)
89
+ before writing tool code. It covers MCP response shapes, property type
90
+ handling (the `data_nindex` problem), and copy-paste Python patterns for
91
+ entity resolution, property formatting, events, and relationships.
92
+
93
+ ## Reliability invariants
94
+
95
+ These constraints reduce failure modes when building graph-aware agents,
96
+ whether using REST or MCP:
97
+
98
+ - **Resolve entities first.** For named-entity questions, do explicit entity
99
+ resolution before deeper property/relationship/event retrieval.
100
+ - **Prefer domain endpoints over heuristic matching.** Use dedicated event or
101
+ relationship APIs (`elemental_get_events`, event endpoints) instead of
102
+ inferring semantics from property/PID names. Substring-matching PID names
103
+ for words like "event" or "filing" returns wrong results — PIDs like
104
+ "filed" are document relationship IDs, not event timestamps.
105
+ - **Keep IDs internal to tool calls.** Use NEIDs/EIDs internally for precise
106
+ requests, and render human-readable names in user-facing output. Never
107
+ show raw NEIDs to users.
108
+ - **Handle reference-typed properties (`data_nindex`).** Some property
109
+ values are entity references (NEIDs), not display text. Use
110
+ `elemental_get_schema` or the data-model skill to check a property's
111
+ type. For `data_nindex` properties (e.g. "country" on an organization),
112
+ resolve the NEID to a display name before rendering. A helper like
113
+ `_pid_types()` that maps PIDs to their schema type is very useful.
114
+ - **Treat 404 as not-found data by default.** Validate server health
115
+ separately before classifying these as connectivity failures.
package/rules/agents.mdc CHANGED
@@ -316,6 +316,24 @@ LLMs are better at parsing prose than nested JSON. The difference between
316
316
  a tool that works reliably and one that confuses the agent often comes down
317
317
  to how the tool formats its output. Follow these principles:
318
318
 
319
+ ### Runtime invariants for data-heavy agents
320
+
321
+ These are generic constraints that improve reliability across graph-backed
322
+ agents (MCP or REST-backed):
323
+
324
+ - **Resolve entities before domain fan-out.** For user prompts about named
325
+ entities, do explicit entity resolution first, then run domain-specific
326
+ retrieval (events, filings, relationships, sanctions, etc.).
327
+ - **Use internal IDs only for precision.** Keep stable IDs (NEID/EID/etc.)
328
+ in tool calls and state, but do not expose raw internal IDs in
329
+ user-facing prose unless the user explicitly asks for them.
330
+ - **Prefer canonical APIs over heuristic parsing.** For domain concepts
331
+ like events, use the dedicated API/tool and its typed fields; do not infer
332
+ semantics from property name substring matching.
333
+ - **Separate gather from synthesize.** Retrieval tools should gather and
334
+ format reliable intermediate outputs; the final user answer should be
335
+ composed after all relevant tool outputs are available.
336
+
319
337
  ### Return formatted strings, not raw JSON
320
338
 
321
339
  This applies to ADK agent tools, where the LLM reads tool output directly.
package/rules/data.mdc CHANGED
@@ -249,6 +249,20 @@ types or property names. Instead, discover them at runtime:
249
249
  This pattern lets agents work with any dataset without needing hardcoded
250
250
  knowledge of what's in the graph.
251
251
 
252
+ ## Semantics-First Data Handling
253
+
254
+ For reliable agent behavior, prefer typed semantics over string heuristics:
255
+
256
+ - **Use canonical endpoints/tools for each domain.** Example: fetch events
257
+ from event APIs (`elemental_get_events` / event endpoints), not by scanning
258
+ unrelated property names for words like "event" or "filing".
259
+ - **Treat reference-typed properties as links, not display text.** For
260
+ relationship/reference values (`data_nindex` and similar), resolve linked
261
+ entities before presenting user-facing output.
262
+ - **Interpret 404s as data absence first.** A 404 on entity/property lookups
263
+ usually means "not found in current data," not transport failure. Validate
264
+ connectivity separately (for example, with health endpoints).
265
+
252
266
  ## API Gotchas
253
267
 
254
268
  ### `getSchema()` response structure differs by endpoint
@@ -43,6 +43,19 @@ Do **not** run Prettier directly — always use `npm run format`. After formatti
43
43
 
44
44
  If a user asks about this error, explain the `npm run format` requirement.
45
45
 
46
- ## Post-Feature: Encourage Push
46
+ ## Pushing
47
47
 
48
- After a feature is fully implemented and committed, use `AskQuestion` to encourage the user to push their branch.
48
+ **Push directly to main.** Vercel auto-deploys on push to main, so this
49
+ gets the app live immediately.
50
+
51
+ **Do NOT create pull requests** — do not run `gh pr create` or create
52
+ feature branches. In Cursor Cloud environments, the GitHub integration
53
+ token lacks PR permissions (known Cursor issue). Pushing to main is the
54
+ correct workflow.
55
+
56
+ ```bash
57
+ git push origin main
58
+ ```
59
+
60
+ If running locally (not in Cursor Cloud), the user may prefer a PR-based
61
+ workflow — ask before pushing directly to main in that case.
@@ -157,21 +157,26 @@ Deploy agents as needed; if the brief relies on **materialized** data, run or sc
157
157
 
158
158
  ## Step 8: Deploy Agents and Next Steps
159
159
 
160
- If the app includes agents in `agents/`, offer to deploy them now:
160
+ If the app includes agents in `agents/`, **deploy them automatically** —
161
+ don't ask for confirmation. Run `/deploy_agent` for each agent immediately
162
+ after pushing. The brief asked you to build an app with agents; deploying
163
+ them is part of delivering a working app.
161
164
 
162
- > Your app is built! I see you have an agent in `agents/`. Want me to
163
- > deploy it now? I can run the deployment for you.
165
+ **Skip `example_agent`** this is a template placeholder, not a real
166
+ agent. Only deploy agents you actually built for this project.
164
167
 
165
- If the user agrees (or if this is an automated build), run `/deploy_agent`
166
- to deploy each agent. Don't just tell the user to type the command do it
167
- for them. Ensure MCP is configured for the agent runtime per `agents-data`.
168
+ After triggering deployment, monitor it yourself (see `/deploy_agent`
169
+ Step 6 for how to poll). Only escalate to the user if deployment fails
170
+ and you can't resolve it.
171
+
172
+ If DESIGN.md explicitly says NOT to deploy, or says to wait for user
173
+ confirmation, respect that. Otherwise, deploy without asking.
168
174
 
169
175
  Then present next steps:
170
176
 
171
177
  > Here's what you can do next:
172
178
  >
173
- > - **Preview locally** with `npm run dev`
174
- > - **Push to deploy** — Vercel auto-deploys on push to main
175
- > - **Deploy agents** — I can deploy them for you, or use the Deploy
176
- > button on the Broadchurch portal's project page
177
- > - **MCP servers** — same as above, from the portal or ask me
179
+ > - **Preview the app** Vercel auto-deployed on push to main
180
+ > - **Agents are deploying** — I triggered deployment; it typically
181
+ > takes 2-5 minutes. I'll let you know when they're registered.
182
+ > - **MCP servers** — deploy from the Broadchurch portal or ask me
@@ -14,7 +14,7 @@ In **mcp-only** mode, **Elemental MCP** is the primary way agents reach the know
14
14
 
15
15
  **B. Investigation / research / aggregation** — Agent uses MCP tools **during multi-step reasoning**: compare entities, trace relationships, pull events or filings, summarize. Typical outputs: a **final answer**, a **report artifact**, or **partial writes** to a store; a full graph replica is optional. Postgres is optional.
16
16
 
17
- **C. Channel / concierge** — Agent is the **users interface** to the graph: user message → agent selects and invokes MCP tools → **natural-language reply** (with optional structured blocks). Often pairs with **`useAgentChat`** in Nuxt; **no local DB** required for the graph if answers are computed on the fly.
17
+ **C. Channel / concierge** — Agent is the **user's interface** to the graph: user message → agent selects and invokes MCP tools → **natural-language reply** (with optional structured blocks). Often pairs with **`useAgentChat`** in Nuxt; **no local DB** required for the graph if answers are computed on the fly.
18
18
 
19
19
  You can deploy **multiple agents** with different mixes of A–C.
20
20
 
@@ -32,7 +32,25 @@ export DATABASE_URL="postgresql://..."
32
32
 
33
33
  ## Tool surface
34
34
 
35
- MCP tools handle schema, entity resolution, related entities, events, sentiment, etc. Use them for **discovery** in research agents and for **batch extraction** in sync agents. Match tool choice to the pattern (A/B/C) in each agents `instruction`.
35
+ MCP tools handle schema, entity resolution, related entities, events, sentiment, etc. Use them for **discovery** in research agents and for **batch extraction** in sync agents. Match tool choice to the pattern (A/B/C) in each agent's `instruction`.
36
+
37
+ **Read the `elemental-mcp-patterns` skill** (`skills/elemental-mcp-patterns/SKILL.md`) before writing tool code. It covers MCP response shapes, property type handling (the `data_nindex` problem), and copy-paste Python patterns for entity resolution, property formatting, events, and relationships.
38
+
39
+ ## Reliability invariants (MCP agents)
40
+
41
+ For MCP-first agents, enforce these runtime rules:
42
+
43
+ - **Resolve first, then fan out.** Start with explicit entity resolution
44
+ before domain-specific calls (events, filings, relationships, sanctions).
45
+ - **Use canonical MCP tools for domain data.** Prefer dedicated tools such as
46
+ `elemental_get_events` for events; avoid deriving domain semantics from
47
+ PID/property-name substring matching.
48
+ - **Use IDs internally, names externally.** Pass NEIDs/entity IDs to tools
49
+ for precision, but present user-facing output using resolved names.
50
+ - **Dereference linked values before display.** If a returned property value
51
+ points to another entity, resolve it to a display name in final output.
52
+ - **Gather, then synthesize.** Let tools gather structured evidence first;
53
+ produce final narrative only after retrieval steps complete.
36
54
 
37
55
  ## When HTTP `elemental_client` still appears
38
56