modelstudio-sdk 0.0.0.dev0__tar.gz
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.
- modelstudio_sdk-0.0.0.dev0/.claude/commands/agent-os/discover-standards.md +261 -0
- modelstudio_sdk-0.0.0.dev0/.claude/commands/agent-os/index-standards.md +124 -0
- modelstudio_sdk-0.0.0.dev0/.claude/commands/agent-os/inject-standards.md +291 -0
- modelstudio_sdk-0.0.0.dev0/.claude/commands/agent-os/plan-product.md +204 -0
- modelstudio_sdk-0.0.0.dev0/.claude/commands/agent-os/shape-spec.md +267 -0
- modelstudio_sdk-0.0.0.dev0/.gitignore +19 -0
- modelstudio_sdk-0.0.0.dev0/.gitlab-ci.yml +76 -0
- modelstudio_sdk-0.0.0.dev0/CLAUDE.md +147 -0
- modelstudio_sdk-0.0.0.dev0/LICENSE +21 -0
- modelstudio_sdk-0.0.0.dev0/Makefile +40 -0
- modelstudio_sdk-0.0.0.dev0/PKG-INFO +513 -0
- modelstudio_sdk-0.0.0.dev0/README.md +493 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/specs/2026-03-06-sdk-phase2-pandas-integration/plan.md +46 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/specs/2026-03-06-sdk-phase2-pandas-integration/references.md +25 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/specs/2026-03-06-sdk-phase2-pandas-integration/shape.md +33 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/specs/2026-03-06-sdk-phase2-pandas-integration/standards.md +25 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/specs/2026-03-10-integration-testing-sdk/plan.md +29 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/specs/2026-03-10-integration-testing-sdk/references.md +40 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/specs/2026-03-10-integration-testing-sdk/shape.md +38 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/specs/2026-03-10-integration-testing-sdk/standards.md +34 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/specs/2026-03-11-1500-sdk-deploy-and-notebooks/plan.md +97 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/specs/2026-03-11-1500-sdk-deploy-and-notebooks/references.md +36 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/specs/2026-03-11-1500-sdk-deploy-and-notebooks/shape.md +38 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/specs/2026-03-11-1500-sdk-deploy-and-notebooks/standards.md +43 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/specs/2026-03-11-1900-custom-notebook-ui/plan.md +103 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/specs/2026-03-11-1900-custom-notebook-ui/references.md +62 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/specs/2026-03-11-1900-custom-notebook-ui/shape.md +42 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/specs/2026-03-11-1900-custom-notebook-ui/standards.md +40 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/specs/2026-03-12-sdk-api-realignment/plan.md +16 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/specs/2026-03-12-sdk-api-realignment/references.md +5 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/specs/2026-03-12-sdk-api-realignment/shape.md +17 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/specs/2026-03-12-sdk-api-realignment/standards.md +8 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/specs/2026-03-12-sdk-tutorials/plan.md +22 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/specs/2026-03-12-sdk-tutorials/shape.md +21 -0
- modelstudio_sdk-0.0.0.dev0/agent-os/standards/index.yml +2 -0
- modelstudio_sdk-0.0.0.dev0/develop.sh +172 -0
- modelstudio_sdk-0.0.0.dev0/docker/.env.example +7 -0
- modelstudio_sdk-0.0.0.dev0/docker/Dockerfile.dev +29 -0
- modelstudio_sdk-0.0.0.dev0/docker/docker-compose.yml +45 -0
- modelstudio_sdk-0.0.0.dev0/docker/requirements.txt +7 -0
- modelstudio_sdk-0.0.0.dev0/gl-sast-report.json +3020 -0
- modelstudio_sdk-0.0.0.dev0/gl-secret-detection-report.json +40 -0
- modelstudio_sdk-0.0.0.dev0/pyproject.toml +55 -0
- modelstudio_sdk-0.0.0.dev0/scripts/get-token.sh +58 -0
- modelstudio_sdk-0.0.0.dev0/scripts/smoke_test.py +204 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/__init__.py +25 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/_http.py +116 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/_pandas.py +33 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/_polling.py +59 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/_version.py +1 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/client.py +108 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/exceptions.py +80 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/models/__init__.py +81 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/models/annotations.py +80 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/models/categories.py +106 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/models/common.py +18 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/models/datasets.py +55 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/models/deletion.py +29 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/models/exports.py +32 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/models/few_shot.py +41 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/models/filters.py +81 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/models/history.py +58 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/models/images.py +91 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/models/imports.py +141 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/models/media.py +37 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/models/merge.py +51 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/models/metrics.py +180 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/models/oversample.py +41 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/models/splits.py +112 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/models/validation.py +89 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/resources/__init__.py +1 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/resources/dataset.py +732 -0
- modelstudio_sdk-0.0.0.dev0/src/modelstudio/resources/split.py +140 -0
- modelstudio_sdk-0.0.0.dev0/tests/__init__.py +0 -0
- modelstudio_sdk-0.0.0.dev0/tests/conftest.py +18 -0
- modelstudio_sdk-0.0.0.dev0/tests/helpers.py +55 -0
- modelstudio_sdk-0.0.0.dev0/tests/integration/__init__.py +0 -0
- modelstudio_sdk-0.0.0.dev0/tests/integration/conftest.py +114 -0
- modelstudio_sdk-0.0.0.dev0/tests/integration/test_connectivity.py +51 -0
- modelstudio_sdk-0.0.0.dev0/tests/integration/test_mutations.py +391 -0
- modelstudio_sdk-0.0.0.dev0/tests/integration/test_read_only.py +292 -0
- modelstudio_sdk-0.0.0.dev0/tests/test_client.py +55 -0
- modelstudio_sdk-0.0.0.dev0/tests/test_http.py +97 -0
- modelstudio_sdk-0.0.0.dev0/tests/test_pandas.py +137 -0
- modelstudio_sdk-0.0.0.dev0/tests/test_polling.py +77 -0
- modelstudio_sdk-0.0.0.dev0/tests/test_resources/__init__.py +0 -0
- modelstudio_sdk-0.0.0.dev0/tests/test_resources/conftest.py +12 -0
- modelstudio_sdk-0.0.0.dev0/tests/test_resources/test_dataset.py +437 -0
- modelstudio_sdk-0.0.0.dev0/tests/test_resources/test_split.py +70 -0
- modelstudio_sdk-0.0.0.dev0/tutorials/.ipynb_checkpoints/getting-started-checkpoint.ipynb +122 -0
- modelstudio_sdk-0.0.0.dev0/tutorials/01-getting-started.ipynb +211 -0
- modelstudio_sdk-0.0.0.dev0/tutorials/02-exploring-data.ipynb +397 -0
- modelstudio_sdk-0.0.0.dev0/tutorials/03-category-management.ipynb +313 -0
- modelstudio_sdk-0.0.0.dev0/tutorials/04-import-export.ipynb +237 -0
- modelstudio_sdk-0.0.0.dev0/tutorials/05-annotations.ipynb +390 -0
- modelstudio_sdk-0.0.0.dev0/tutorials/06-advanced-workflows.ipynb +498 -0
- modelstudio_sdk-0.0.0.dev0/tutorials/README.md +52 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
# Discover Standards
|
|
2
|
+
|
|
3
|
+
Extract tribal knowledge from your codebase into concise, documented standards.
|
|
4
|
+
|
|
5
|
+
## Important Guidelines
|
|
6
|
+
|
|
7
|
+
- **Always use AskUserQuestion tool** when asking the user anything
|
|
8
|
+
- **Write concise standards** — Use minimal words. Standards must be scannable by AI agents without bloating context windows.
|
|
9
|
+
- **Offer suggestions** — Present options the user can confirm, choose between, or correct. Don't make them think harder than necessary.
|
|
10
|
+
|
|
11
|
+
## Process
|
|
12
|
+
|
|
13
|
+
### Step 1: Determine Focus Area
|
|
14
|
+
|
|
15
|
+
Check if the user specified an area when running this command. If they did, skip to Step 2.
|
|
16
|
+
|
|
17
|
+
If no area was specified:
|
|
18
|
+
|
|
19
|
+
1. Analyze the codebase structure (folders, file types, patterns)
|
|
20
|
+
2. Identify 3-5 major areas. Examples:
|
|
21
|
+
- **Frontend areas:** UI components, styling/CSS, state management, forms, routing
|
|
22
|
+
- **Backend areas:** API routes, database/models, authentication, background jobs
|
|
23
|
+
- **Cross-cutting:** Error handling, validation, testing, naming conventions, file structure
|
|
24
|
+
3. Use AskUserQuestion to present the areas:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
I've identified these areas in your codebase:
|
|
28
|
+
|
|
29
|
+
1. **API Routes** (src/api/) — Request handling, response formats
|
|
30
|
+
2. **Database** (src/models/, src/db/) — Models, queries, migrations
|
|
31
|
+
3. **React Components** (src/components/) — UI patterns, props, state
|
|
32
|
+
4. **Authentication** (src/auth/) — Login, sessions, permissions
|
|
33
|
+
|
|
34
|
+
Which area should we focus on for discovering standards? (Pick one, or suggest a different area)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Wait for user response before proceeding.
|
|
38
|
+
|
|
39
|
+
### Step 2: Analyze & Present Findings
|
|
40
|
+
|
|
41
|
+
Once an area is determined:
|
|
42
|
+
|
|
43
|
+
1. Read key files in that area (5-10 representative files)
|
|
44
|
+
2. Look for patterns that are:
|
|
45
|
+
- **Unusual or unconventional** — Not standard framework/library patterns
|
|
46
|
+
- **Opinionated** — Specific choices that could have gone differently
|
|
47
|
+
- **Tribal** — Things a new developer wouldn't know without being told
|
|
48
|
+
- **Consistent** — Patterns repeated across multiple files
|
|
49
|
+
|
|
50
|
+
3. Use AskUserQuestion to present findings and let user select:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
I analyzed [area] and found these potential standards worth documenting:
|
|
54
|
+
|
|
55
|
+
1. **API Response Envelope** — All responses use { success, data, error } structure
|
|
56
|
+
2. **Error Codes** — Custom error codes like AUTH_001, DB_002 with specific meanings
|
|
57
|
+
3. **Pagination Pattern** — Cursor-based pagination with consistent param names
|
|
58
|
+
|
|
59
|
+
Which would you like to document?
|
|
60
|
+
|
|
61
|
+
Options:
|
|
62
|
+
- "Yes, all of them"
|
|
63
|
+
- "Just 1 and 3"
|
|
64
|
+
- "Add: [your suggestion]"
|
|
65
|
+
- "Skip this area"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Wait for user selection before proceeding.
|
|
69
|
+
|
|
70
|
+
### Step 3: Ask Why, Then Draft Each Standard
|
|
71
|
+
|
|
72
|
+
**IMPORTANT:** For each selected standard, you MUST complete this full loop before moving to the next standard:
|
|
73
|
+
|
|
74
|
+
1. **Ask 1-2 clarifying questions** about the "why" behind the pattern. Use your AskUserQuestion tool for this.
|
|
75
|
+
2. **Wait for user response**
|
|
76
|
+
3. **Draft the standard** incorporating their answer
|
|
77
|
+
4. **Confirm with user** before creating the file
|
|
78
|
+
5. **Create the file** if approved
|
|
79
|
+
|
|
80
|
+
Example questions to ask (adapt based on the specific standard):
|
|
81
|
+
|
|
82
|
+
- "What problem does this pattern solve? Why not use the default/common approach?"
|
|
83
|
+
- "Are there exceptions where this pattern shouldn't be used?"
|
|
84
|
+
- "What's the most common mistake a developer or agent makes with this?"
|
|
85
|
+
|
|
86
|
+
**Do NOT batch all questions upfront.** Process one standard at a time through the full loop.
|
|
87
|
+
|
|
88
|
+
### Step 4: Create the Standard File
|
|
89
|
+
|
|
90
|
+
For each standard (after completing Step 3's Q&A):
|
|
91
|
+
|
|
92
|
+
1. Determine the appropriate folder (create if needed):
|
|
93
|
+
- `api/`, `database/`, `javascript/`, `css/`, `backend/`, `testing/`, `global/`
|
|
94
|
+
|
|
95
|
+
2. Check if a related standard file already exists — append to it if so
|
|
96
|
+
|
|
97
|
+
3. Draft the content and use AskUserQuestion to confirm:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
Here's the draft for api/response-format.md:
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
# API Response Format
|
|
104
|
+
|
|
105
|
+
All API responses use this envelope:
|
|
106
|
+
|
|
107
|
+
\`\`\`json
|
|
108
|
+
{ "success": true, "data": { ... } }
|
|
109
|
+
{ "success": false, "error": { "code": "...", "message": "..." } }
|
|
110
|
+
\`\`\`
|
|
111
|
+
|
|
112
|
+
- Never return raw data without the envelope
|
|
113
|
+
- Error responses must include both code and message
|
|
114
|
+
- Success responses omit the error field entirely
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
Create this file? (yes / edit: [your changes] / skip)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
4. Create or update the file in `agent-os/standards/[folder]/`
|
|
121
|
+
5. **Then repeat Steps 3-4 for the next selected standard**
|
|
122
|
+
|
|
123
|
+
### Step 5: Update the Index
|
|
124
|
+
|
|
125
|
+
After all standards are created:
|
|
126
|
+
|
|
127
|
+
1. Scan `agent-os/standards/` for all `.md` files
|
|
128
|
+
2. For each new file without an index entry, use AskUserQuestion:
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
New standard needs an index entry:
|
|
132
|
+
File: api/response-format.md
|
|
133
|
+
|
|
134
|
+
Suggested description: "API response envelope structure and error format"
|
|
135
|
+
|
|
136
|
+
Accept this description? (yes / or type a better one)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
3. Update `agent-os/standards/index.yml`:
|
|
140
|
+
|
|
141
|
+
```yaml
|
|
142
|
+
api:
|
|
143
|
+
response-format:
|
|
144
|
+
description: API response envelope structure and error format
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Alphabetize by folder, then by filename.
|
|
148
|
+
|
|
149
|
+
### Step 6: Offer to Continue
|
|
150
|
+
|
|
151
|
+
Use AskUserQuestion:
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
Standards created for [area]:
|
|
155
|
+
- api/response-format.md
|
|
156
|
+
- api/error-codes.md
|
|
157
|
+
|
|
158
|
+
Would you like to discover standards in another area, or are we done?
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Output Location
|
|
162
|
+
|
|
163
|
+
All standards: `agent-os/standards/[folder]/[standard].md`
|
|
164
|
+
Index file: `agent-os/standards/index.yml`
|
|
165
|
+
|
|
166
|
+
## Writing Concise Standards
|
|
167
|
+
|
|
168
|
+
Standards will be injected into AI context windows. Every word costs tokens. Follow these rules:
|
|
169
|
+
|
|
170
|
+
- **Lead with the rule** — State what to do first, explain why second (if needed)
|
|
171
|
+
- **Use code examples** — Show, don't tell
|
|
172
|
+
- **Skip the obvious** — Don't document what the code already makes clear
|
|
173
|
+
- **One standard per concept** — Don't combine unrelated patterns
|
|
174
|
+
- **Bullet points over paragraphs** — Scannable beats readable
|
|
175
|
+
|
|
176
|
+
**Good:**
|
|
177
|
+
```markdown
|
|
178
|
+
# Error Responses
|
|
179
|
+
|
|
180
|
+
Use error codes: `AUTH_001`, `DB_001`, `VAL_001`
|
|
181
|
+
|
|
182
|
+
\`\`\`json
|
|
183
|
+
{ "success": false, "error": { "code": "AUTH_001", "message": "..." } }
|
|
184
|
+
\`\`\`
|
|
185
|
+
|
|
186
|
+
- Always include both code and message
|
|
187
|
+
- Log full error server-side, return safe message to client
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Bad:**
|
|
191
|
+
```markdown
|
|
192
|
+
# Error Handling Guidelines
|
|
193
|
+
|
|
194
|
+
When an error occurs in our application, we have established a consistent pattern for how errors should be formatted and returned to the client. This helps maintain consistency across our API and makes it easier for frontend developers to handle errors appropriately...
|
|
195
|
+
[continues for 3 more paragraphs]
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Example: Full Loop for One Standard
|
|
199
|
+
|
|
200
|
+
Here's how to process a single standard through the complete workflow:
|
|
201
|
+
|
|
202
|
+
**1. Present findings (Step 2):**
|
|
203
|
+
```
|
|
204
|
+
I found these patterns in your API code:
|
|
205
|
+
1. **Response Envelope** — All responses use { success, data, error }
|
|
206
|
+
2. **Error Codes** — Custom codes like AUTH_001
|
|
207
|
+
|
|
208
|
+
Which would you like to document?
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
User: "Both"
|
|
212
|
+
|
|
213
|
+
**2. Ask why for first standard (Step 3):**
|
|
214
|
+
```
|
|
215
|
+
For the Response Envelope pattern:
|
|
216
|
+
- What problem does this solve? Why not return raw data?
|
|
217
|
+
- Are there any endpoints that don't use this pattern?
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
User: "We use it so the frontend always knows where to find the data. All endpoints use it, no exceptions."
|
|
221
|
+
|
|
222
|
+
**3. Draft first standard (Step 3 continued):**
|
|
223
|
+
```
|
|
224
|
+
Here's the draft for api/response-envelope.md:
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
# Response Envelope
|
|
228
|
+
|
|
229
|
+
All API responses use this structure:
|
|
230
|
+
\`\`\`json
|
|
231
|
+
{ "success": true, "data": { ... } }
|
|
232
|
+
{ "success": false, "error": { ... } }
|
|
233
|
+
\`\`\`
|
|
234
|
+
|
|
235
|
+
- Frontend always checks `success` first, then reads `data` or `error`
|
|
236
|
+
- No exceptions — every endpoint uses this format
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
Create this file?
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
User: "Yes"
|
|
243
|
+
|
|
244
|
+
**4. Create file, then move to next standard:**
|
|
245
|
+
|
|
246
|
+
[Create the file]
|
|
247
|
+
|
|
248
|
+
**5. Ask why for second standard (back to Step 3):**
|
|
249
|
+
```
|
|
250
|
+
For the Error Codes pattern:
|
|
251
|
+
- What's the naming convention for codes?
|
|
252
|
+
- Where should new error codes be documented?
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
User: "Format is AREA_NUMBER like AUTH_001. We keep a list in the wiki."
|
|
256
|
+
|
|
257
|
+
**6. Draft second standard, confirm, create file...**
|
|
258
|
+
|
|
259
|
+
[Continue until all selected standards are done]
|
|
260
|
+
|
|
261
|
+
**Key point:** Complete the full ask → draft → confirm → create cycle for each standard before starting the next one.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Index Standards
|
|
2
|
+
|
|
3
|
+
Rebuild and maintain the standards index file (`index.yml`).
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
The index enables `/inject-standards` to suggest relevant standards without reading all files. It maps each standard to a brief description for quick matching.
|
|
8
|
+
|
|
9
|
+
## Process
|
|
10
|
+
|
|
11
|
+
### Step 1: Scan for Standards Files
|
|
12
|
+
|
|
13
|
+
1. List all `.md` files in `agent-os/standards/` and its subfolders
|
|
14
|
+
2. Build a list of all standards organized by folder:
|
|
15
|
+
```
|
|
16
|
+
root/coding-style.md # Files in standards/ root use "root" as the folder name
|
|
17
|
+
root/naming.md
|
|
18
|
+
api/response-format.md
|
|
19
|
+
api/error-handling.md
|
|
20
|
+
database/migrations.md
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Note:** `root` is a reserved keyword — it refers to `.md` files directly in `agent-os/standards/` (not in a subfolder). Do not create an actual folder named "root".
|
|
24
|
+
|
|
25
|
+
### Step 2: Load Existing Index
|
|
26
|
+
|
|
27
|
+
Read `agent-os/standards/index.yml` if it exists. Note which entries already have descriptions.
|
|
28
|
+
|
|
29
|
+
### Step 3: Identify Changes
|
|
30
|
+
|
|
31
|
+
Compare the file scan with the existing index:
|
|
32
|
+
|
|
33
|
+
- **New files** — Standards files without index entries
|
|
34
|
+
- **Deleted files** — Index entries for files that no longer exist
|
|
35
|
+
- **Existing files** — Already indexed, keep as-is
|
|
36
|
+
|
|
37
|
+
### Step 4: Handle New Files
|
|
38
|
+
|
|
39
|
+
For each new standard file that needs an index entry:
|
|
40
|
+
|
|
41
|
+
1. Read the file to understand its content
|
|
42
|
+
2. Use AskUserQuestion to propose a description:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
New standard needs indexing:
|
|
46
|
+
File: api/response-format.md
|
|
47
|
+
|
|
48
|
+
Suggested description: "API response envelope structure and error format"
|
|
49
|
+
|
|
50
|
+
Accept? (yes / or type a better description)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Keep descriptions to **one short sentence** — they're for matching, not documentation.
|
|
54
|
+
|
|
55
|
+
### Step 5: Handle Deleted Files
|
|
56
|
+
|
|
57
|
+
If there are index entries for files that no longer exist:
|
|
58
|
+
|
|
59
|
+
1. List them for the user
|
|
60
|
+
2. Remove them from the index automatically (no confirmation needed)
|
|
61
|
+
|
|
62
|
+
Report: "Removed 2 stale index entries: api/old-pattern.md, testing/deprecated.md"
|
|
63
|
+
|
|
64
|
+
### Step 6: Write Updated Index
|
|
65
|
+
|
|
66
|
+
Generate `agent-os/standards/index.yml` with this structure:
|
|
67
|
+
|
|
68
|
+
```yaml
|
|
69
|
+
folder-name:
|
|
70
|
+
file-name:
|
|
71
|
+
description: Brief description here
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Rules:**
|
|
75
|
+
- Alphabetize folders
|
|
76
|
+
- Alphabetize files within each folder
|
|
77
|
+
- File names without `.md` extension
|
|
78
|
+
- One-line descriptions only
|
|
79
|
+
|
|
80
|
+
**Example:**
|
|
81
|
+
```yaml
|
|
82
|
+
root:
|
|
83
|
+
coding-style:
|
|
84
|
+
description: General coding style, formatting, linting rules
|
|
85
|
+
naming:
|
|
86
|
+
description: File naming, variable naming, class naming conventions
|
|
87
|
+
|
|
88
|
+
api:
|
|
89
|
+
error-handling:
|
|
90
|
+
description: Error codes, exception handling, error response format
|
|
91
|
+
response-format:
|
|
92
|
+
description: API response envelope structure, status codes, pagination
|
|
93
|
+
|
|
94
|
+
database:
|
|
95
|
+
migrations:
|
|
96
|
+
description: Migration file structure, naming conventions, rollback patterns
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Note:** `root` appears first and contains standards files that live directly in `agent-os/standards/` (not in subfolders).
|
|
100
|
+
|
|
101
|
+
### Step 7: Report Results
|
|
102
|
+
|
|
103
|
+
Summarize what changed:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
Index updated:
|
|
107
|
+
✓ 2 new entries added
|
|
108
|
+
✓ 1 stale entry removed
|
|
109
|
+
✓ 8 entries unchanged
|
|
110
|
+
|
|
111
|
+
Total: 9 standards indexed
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## When to Run
|
|
115
|
+
|
|
116
|
+
- After manually creating or deleting standards files
|
|
117
|
+
- If `/inject-standards` suggestions seem out of sync
|
|
118
|
+
- To clean up a messy or outdated index
|
|
119
|
+
|
|
120
|
+
**Note:** `/discover-standards` runs this automatically as its final step, so you usually don't need to call it separately after discovering standards.
|
|
121
|
+
|
|
122
|
+
## Output
|
|
123
|
+
|
|
124
|
+
Updates `agent-os/standards/index.yml`
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
# Inject Standards
|
|
2
|
+
|
|
3
|
+
Inject relevant standards into the current context, formatted appropriately for the situation.
|
|
4
|
+
|
|
5
|
+
## Usage Modes
|
|
6
|
+
|
|
7
|
+
This command supports two modes:
|
|
8
|
+
|
|
9
|
+
### Auto-Suggest Mode (no arguments)
|
|
10
|
+
```
|
|
11
|
+
/inject-standards
|
|
12
|
+
```
|
|
13
|
+
Analyzes context and suggests relevant standards.
|
|
14
|
+
|
|
15
|
+
### Explicit Mode (with arguments)
|
|
16
|
+
```
|
|
17
|
+
/inject-standards api # All standards in api/
|
|
18
|
+
/inject-standards api/response-format # Single file
|
|
19
|
+
/inject-standards api/response-format api/auth # Multiple files
|
|
20
|
+
/inject-standards root # All standards in the root folder
|
|
21
|
+
/inject-standards root/naming # Single file from root folder
|
|
22
|
+
```
|
|
23
|
+
Directly injects specified standards without suggestions.
|
|
24
|
+
|
|
25
|
+
**Note:** `root` is a reserved keyword — it refers to `.md` files directly in `agent-os/standards/` (not in a subfolder).
|
|
26
|
+
|
|
27
|
+
## Process
|
|
28
|
+
|
|
29
|
+
### Step 1: Detect Context Scenario
|
|
30
|
+
|
|
31
|
+
Before injecting standards, determine which scenario we're in. Read the current conversation and check if we're in plan mode.
|
|
32
|
+
|
|
33
|
+
**Three scenarios:**
|
|
34
|
+
|
|
35
|
+
1. **Conversation** — Regular chat, implementing code, answering questions
|
|
36
|
+
2. **Creating a Skill** — Building a `.claude/skills/` file
|
|
37
|
+
3. **Shaping/Planning** — In plan mode, building a spec, running `/shape-spec`
|
|
38
|
+
|
|
39
|
+
**Detection logic:**
|
|
40
|
+
|
|
41
|
+
- If currently in plan mode OR conversation clearly mentions "spec", "plan", "shape" → **Shaping/Planning**
|
|
42
|
+
- If conversation clearly mentions creating a skill, editing `.claude/skills/`, or building a reusable procedure → **Creating a Skill**
|
|
43
|
+
- Otherwise → **Ask to confirm** (do not assume)
|
|
44
|
+
|
|
45
|
+
**If neither skill nor plan is clearly detected**, use AskUserQuestion to confirm:
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
I'll inject the relevant standards. How should I format them?
|
|
49
|
+
|
|
50
|
+
1. **Conversation** — Read standards into our chat (for implementation work)
|
|
51
|
+
2. **Skill** — Output file references to include in a skill you're building
|
|
52
|
+
3. **Plan** — Output file references to include in a plan/spec
|
|
53
|
+
|
|
54
|
+
Which scenario? (1, 2, or 3)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Always ask when uncertain — don't assume conversation by default.
|
|
58
|
+
|
|
59
|
+
### Step 2: Read the Index (Auto-Suggest Mode)
|
|
60
|
+
|
|
61
|
+
Read `agent-os/standards/index.yml` to get the list of available standards and their descriptions.
|
|
62
|
+
|
|
63
|
+
If index.yml doesn't exist or is empty:
|
|
64
|
+
```
|
|
65
|
+
No standards index found. Run /discover-standards first to create standards,
|
|
66
|
+
or /index-standards if you have standards files without an index.
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Step 3: Analyze Work Context
|
|
70
|
+
|
|
71
|
+
Look at the current conversation to understand what the user is working on:
|
|
72
|
+
- What type of work? (API, database, UI, etc.)
|
|
73
|
+
- What technologies mentioned?
|
|
74
|
+
- What's the goal?
|
|
75
|
+
|
|
76
|
+
### Step 4: Match and Suggest
|
|
77
|
+
|
|
78
|
+
Match index descriptions against the context. Use AskUserQuestion to present suggestions:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
Based on your task, these standards may be relevant:
|
|
82
|
+
|
|
83
|
+
1. **api/response-format** — API response envelope structure, status codes
|
|
84
|
+
2. **api/error-handling** — Error codes, exception handling, error responses
|
|
85
|
+
3. **global/naming** — File naming, variable naming conventions
|
|
86
|
+
|
|
87
|
+
Inject these standards? (yes / just 1 and 3 / add: database/migrations / none)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Keep suggestions focused — typically 2-5 standards. Don't overwhelm with too many options.
|
|
91
|
+
|
|
92
|
+
### Step 5: Inject Based on Scenario
|
|
93
|
+
|
|
94
|
+
Format the output differently based on the detected scenario:
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
#### Scenario: Conversation
|
|
99
|
+
|
|
100
|
+
Read the standards and announce them:
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
I've read the following standards as they are relevant to what we're working on:
|
|
104
|
+
|
|
105
|
+
--- Standard: api/response-format ---
|
|
106
|
+
|
|
107
|
+
[full content of the standard file]
|
|
108
|
+
|
|
109
|
+
--- End Standard ---
|
|
110
|
+
|
|
111
|
+
--- Standard: api/error-handling ---
|
|
112
|
+
|
|
113
|
+
[full content of the standard file]
|
|
114
|
+
|
|
115
|
+
--- End Standard ---
|
|
116
|
+
|
|
117
|
+
**Key points:**
|
|
118
|
+
- All API responses use { success, data, error } envelope
|
|
119
|
+
- Error codes follow AUTH_xxx, DB_xxx pattern
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
#### Scenario: Creating a Skill
|
|
125
|
+
|
|
126
|
+
First, use AskUserQuestion to determine how to include the standards:
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
How should these standards be included in your skill?
|
|
130
|
+
|
|
131
|
+
1. **References** — Add @ file paths that point to the standards (keeps skill lightweight, standards stay in sync)
|
|
132
|
+
2. **Copy content** — Paste the full standards content into the skill (self-contained, but won't update if standards change)
|
|
133
|
+
|
|
134
|
+
Which approach? (1 or 2)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**If References (option 1):**
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
Be sure to include references to the following standards files in the appropriate location in the file(s) that make up this skill:
|
|
141
|
+
|
|
142
|
+
@agent-os/standards/api/response-format.md
|
|
143
|
+
@agent-os/standards/api/error-handling.md
|
|
144
|
+
@agent-os/standards/global/naming.md
|
|
145
|
+
|
|
146
|
+
These standards cover:
|
|
147
|
+
- API response envelope structure, status codes
|
|
148
|
+
- Error codes, exception handling, error responses
|
|
149
|
+
- File naming, variable naming conventions
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**If Copy content (option 2):**
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
Include the following standards content in your skill:
|
|
156
|
+
|
|
157
|
+
--- Standard: api/response-format ---
|
|
158
|
+
|
|
159
|
+
[full content of the standard file]
|
|
160
|
+
|
|
161
|
+
--- End Standard ---
|
|
162
|
+
|
|
163
|
+
--- Standard: api/error-handling ---
|
|
164
|
+
|
|
165
|
+
[full content of the standard file]
|
|
166
|
+
|
|
167
|
+
--- End Standard ---
|
|
168
|
+
|
|
169
|
+
These standards cover:
|
|
170
|
+
- API response envelope structure, status codes
|
|
171
|
+
- Error codes, exception handling, error responses
|
|
172
|
+
- File naming, variable naming conventions
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
#### Scenario: Shaping/Planning
|
|
178
|
+
|
|
179
|
+
First, use AskUserQuestion to determine how to include the standards:
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
How should these standards be included in your plan?
|
|
183
|
+
|
|
184
|
+
1. **References** — Add @ file paths that point to the standards (keeps plan lightweight, standards stay in sync)
|
|
185
|
+
2. **Copy content** — Paste the full standards content into the plan (self-contained, but won't update if standards change)
|
|
186
|
+
|
|
187
|
+
Which approach? (1 or 2)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**If References (option 1):**
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
Be sure to include references to the following standards files in the appropriate location in the plan we're building:
|
|
194
|
+
|
|
195
|
+
@agent-os/standards/api/response-format.md
|
|
196
|
+
@agent-os/standards/api/error-handling.md
|
|
197
|
+
@agent-os/standards/global/naming.md
|
|
198
|
+
|
|
199
|
+
These standards cover:
|
|
200
|
+
- API response envelope structure, status codes
|
|
201
|
+
- Error codes, exception handling, error responses
|
|
202
|
+
- File naming, variable naming conventions
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**If Copy content (option 2):**
|
|
206
|
+
|
|
207
|
+
```
|
|
208
|
+
Include the following standards content in your plan:
|
|
209
|
+
|
|
210
|
+
--- Standard: api/response-format ---
|
|
211
|
+
|
|
212
|
+
[full content of the standard file]
|
|
213
|
+
|
|
214
|
+
--- End Standard ---
|
|
215
|
+
|
|
216
|
+
--- Standard: api/error-handling ---
|
|
217
|
+
|
|
218
|
+
[full content of the standard file]
|
|
219
|
+
|
|
220
|
+
--- End Standard ---
|
|
221
|
+
|
|
222
|
+
These standards cover:
|
|
223
|
+
- API response envelope structure, status codes
|
|
224
|
+
- Error codes, exception handling, error responses
|
|
225
|
+
- File naming, variable naming conventions
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
### Step 6: Surface Related Skills (Conversation scenario only)
|
|
231
|
+
|
|
232
|
+
When in conversation scenario, check if `.claude/skills/` exists and contains related skills:
|
|
233
|
+
|
|
234
|
+
```
|
|
235
|
+
Related Skills you might want to use:
|
|
236
|
+
- create-api-endpoint — Scaffolds new API endpoints following these standards
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Don't invoke skills automatically — just surface them for awareness.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Explicit Mode
|
|
244
|
+
|
|
245
|
+
When arguments are provided, skip the suggestion step but still detect scenario.
|
|
246
|
+
|
|
247
|
+
### Step 1: Detect Scenario
|
|
248
|
+
|
|
249
|
+
Same as auto-suggest mode.
|
|
250
|
+
|
|
251
|
+
### Step 2: Parse Arguments
|
|
252
|
+
|
|
253
|
+
Arguments can be:
|
|
254
|
+
- **Folder name** — `api` → inject all `.md` files in `agent-os/standards/api/`
|
|
255
|
+
- **Folder/file** — `api/response-format` → inject `agent-os/standards/api/response-format.md`
|
|
256
|
+
- **Root folder** — `root` → inject all `.md` files directly in `agent-os/standards/` (not in subfolders)
|
|
257
|
+
- **Root file** — `root/naming` → inject `agent-os/standards/naming.md`
|
|
258
|
+
|
|
259
|
+
Multiple arguments inject multiple standards.
|
|
260
|
+
|
|
261
|
+
### Step 3: Validate
|
|
262
|
+
|
|
263
|
+
Check that specified files/folders exist. If not:
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
Standard not found: api/nonexistent
|
|
267
|
+
|
|
268
|
+
Available standards in api/:
|
|
269
|
+
- response-format
|
|
270
|
+
- error-handling
|
|
271
|
+
- authentication
|
|
272
|
+
|
|
273
|
+
Did you mean one of these?
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Step 4: Inject Based on Scenario
|
|
277
|
+
|
|
278
|
+
Same formatting as auto-suggest mode, based on detected scenario.
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Tips
|
|
283
|
+
|
|
284
|
+
- **Run early** — Inject standards at the start of a task, before implementation
|
|
285
|
+
- **Be specific** — If you know which standards apply, use explicit mode
|
|
286
|
+
- **Check the index** — If suggestions seem wrong, run `/index-standards` to rebuild
|
|
287
|
+
- **Keep standards concise** — Injected standards consume tokens; shorter is better
|
|
288
|
+
|
|
289
|
+
## Integration
|
|
290
|
+
|
|
291
|
+
This command is called internally by `/shape-spec` to inject relevant standards during planning. You can also invoke it directly anytime you need standards in context.
|