mainsequence 9.0.23.dev66__py3-none-any.whl → 9.0.24.dev67__py3-none-any.whl

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.
@@ -67,7 +67,7 @@ This skill audits. It does not implement by default.
67
67
 
68
68
  ## Read First
69
69
 
70
- 1. `AGENTS.md`
70
+ 1. Repository instructions, including `AGENTS.md` when present.
71
71
  2. the relevant installed skill and version-aligned documentation for the failing workflow
72
72
 
73
73
  ## Inputs This Skill Needs
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mainsequence-code-repository-maintenance
3
- description: Maintain an existing Main Sequence CodeRepository checkout using the SDK-version-matched CLI. Use for inspecting repository state, building or repairing .venv, refreshing local authentication, performing explicitly requested SDK, skill, or AGENTS.md updates, refreshing dependency files with CodeRepository sync, publishing changes with Git, or diagnosing a partially completed maintenance workflow.
3
+ description: Maintain an existing Main Sequence CodeRepository checkout using the SDK-version-matched CLI. Use for inspecting repository state, building or repairing .venv, refreshing local authentication, performing explicitly requested SDK or skill updates, refreshing dependency files with CodeRepository sync, publishing changes with Git, or diagnosing a partially completed maintenance workflow.
4
4
  ---
5
5
 
6
6
  # Main Sequence CodeRepository Maintenance
@@ -16,7 +16,7 @@ workflows.
16
16
  Own:
17
17
 
18
18
  - local CodeRepository inspection and maintenance sequencing;
19
- - `.venv`, SDK, managed skill, `AGENTS.md`, dependency sync, and Git publishing
19
+ - `.venv`, SDK, managed skill, dependency sync, and Git publishing
20
20
  workflows;
21
21
  - precondition checks, explicit approval gates, and partial-failure diagnosis.
22
22
 
@@ -45,7 +45,8 @@ fall back to credential claims or injected CodeRepositoryBranch values.
45
45
 
46
46
  ## Inspect Before Changing State
47
47
 
48
- 1. Read `AGENTS.md` and the relevant repository skills.
48
+ 1. Follow repository instructions, including `AGENTS.md` when present, and read
49
+ the relevant skills. The SDK never scaffolds or edits repository `AGENTS.md`.
49
50
  2. Confirm the repository root and the user's requested maintenance outcome.
50
51
  3. Inspect code repository and Git state:
51
52
 
@@ -55,11 +56,10 @@ fall back to credential claims or injected CodeRepositoryBranch values.
55
56
  git status --short
56
57
  ```
57
58
 
58
- The `code-repository current` result must report the logical `code_repository_uid`, current
59
- `git_branch`, `code_repository_branch_uid`, and `code_repository_branch_status=resolved`.
60
- Treat a detached checkout, unresolved repository, or unresolved/unregistered
61
- Git branch as a maintenance preflight failure before any
62
- mutating workflow.
59
+ Before branch-owned platform operations, require the current Git branch,
60
+ `code_repository_branch_uid`, and `code_repository_branch_status=resolved`.
61
+ Local environment and skill updates do not require a registered platform
62
+ branch or a signed-in session.
63
63
 
64
64
  4. Separate existing user changes from changes created by the maintenance
65
65
  task. Never assume every uncommitted file belongs to the current task.
@@ -173,17 +173,14 @@ the failure. On success, reload this maintenance skill before continuing.
173
173
  Do not automatically commit or push an SDK update unless the user also asked
174
174
  to publish the CodeRepository changes.
175
175
 
176
- ## Refresh Managed Skills And Instructions
176
+ ## Refresh SDK Skills And Instructions
177
177
 
178
- Outside the skill refresh included in `update-sdk`, run either managed-scaffold
179
- command only when the user explicitly requests that specific update. When both
180
- are requested, refresh the SDK-owned skills first,
181
- then update the managed Main Sequence block in
182
- `AGENTS.md`:
178
+ SDK instructions and domain skills are one versioned bundle. Outside the
179
+ refresh included in `update-sdk`, run this command only when the user explicitly
180
+ requests a skill update:
183
181
 
184
182
  ```bash
185
183
  uv run --offline mainsequence code-repository update-agent-skills --path .
186
- uv run --offline mainsequence code-repository update AGENTS.md --path .
187
184
  ```
188
185
 
189
186
  Verify `.agents/skills/mainsequence/PINNED_FROM.txt` after success:
@@ -198,6 +195,13 @@ or platform access and deletes obsolete folders, including retired table
198
195
  workflow skills. Do not preserve old or platform-owned content in that folder.
199
196
  The installed `metatables` package owns table workflows in its own namespace.
200
197
 
198
+ A missing or mismatched sentinel is a condition to report, not permission to
199
+ update. The same applies to other libraries' sentinels. The `mainsequence` CLI
200
+ does not manage `.agents/skills/ms_tau_sdk/`; its owner refreshes that namespace
201
+ with `uv run ms-tau skills sync --path .` when requested. Keep repository-owned
202
+ `AGENTS.md` as written, including any older managed blocks. Removing such a
203
+ block is a separate repository edit requested by its owner.
204
+
201
205
  When the user requests platform skills, use the separate authenticated command:
202
206
 
203
207
  ```bash
@@ -419,7 +423,7 @@ Never rerun an entire mutating workflow blindly.
419
423
 
420
424
  ## Validate And Report
421
425
 
422
- Run only repository-relevant validation discovered from `AGENTS.md`, repository
426
+ Run only repository-relevant validation discovered from existing repository instructions,
423
427
  documentation, and the changed files. Report:
424
428
 
425
429
  - the maintenance routine performed;
@@ -58,7 +58,7 @@ This skill only reasons about access to deployed resources such as `ResourceRele
58
58
 
59
59
  ## Read First
60
60
 
61
- 1. `AGENTS.md`
61
+ 1. Repository instructions, including `AGENTS.md` when present.
62
62
  2. <https://mainsequence-sdk.github.io/mainsequence-sdk/knowledge/infrastructure/users_and_access/>
63
63
  3. <https://mainsequence-sdk.github.io/mainsequence-sdk/knowledge/infrastructure/constants_and_secrets/>
64
64
 
@@ -48,7 +48,7 @@ This skill must not claim ownership of:
48
48
 
49
49
  ## Read First
50
50
 
51
- 1. `AGENTS.md`
51
+ 1. Repository instructions, including `AGENTS.md` when present.
52
52
  2. <https://mainsequence-sdk.github.io/mainsequence-sdk/knowledge/infrastructure/scheduling_jobs/>
53
53
  3. <https://mainsequence-sdk.github.io/mainsequence-sdk/knowledge/infrastructure/artifacts/>
54
54
  4. <https://mainsequence-sdk.github.io/mainsequence-sdk/knowledge/infrastructure/owner_observability/> when inspecting logs or resource usage
@@ -1,241 +1,131 @@
1
1
  ---
2
2
  name: mainsequence-sdk-code-repository-execution
3
- description: Use the installed Main Sequence SDK and repository-local tools to verify CodeRepository context, apply local scaffold conventions, and route concrete implementation work. Use a platform-owned design skill first only when architecture or ontology is unresolved.
3
+ description: Use the installed Main Sequence SDK and CLI for Git-derived CodeRepository context, version-matched contract authority, and selecting the relevant SDK or domain-package skill. Use for repository integration and SDK execution questions; use a platform-owned design skill when architecture or ontology is unresolved.
4
4
  ---
5
5
 
6
6
  # Main Sequence SDK CodeRepository Execution
7
7
 
8
- ## Overview
9
-
10
- Use this SDK-owned skill for local SDK, CLI, filesystem, repository mechanics,
11
- and implementation routing. A platform-owned design skill is required first
12
- only when product architecture, ontology, or the CodeRepository Blueprint is
13
- unresolved. Maintenance, audits, and already-scoped implementation work do not
14
- require a design-first sequence.
15
-
16
- This skill is for:
17
-
18
- - establishing code repository context
19
- - defining success up front
20
- - enforcing a docs-first workflow
21
- - verifying platform context before making claims
22
- - routing work to the correct specialized skill
23
-
24
- ## This Skill Can Do
25
-
26
- - determine the correct startup and read order
27
- - define a concrete success condition before implementation starts
28
- - verify current code repository and platform context
29
- - decide which specialized skill owns the actual domain work
30
- - enforce standard Main Sequence repository structure expectations
31
- - separate verified facts from assumptions
32
- - surface documentation mismatches to the user
33
-
34
- ## This Skill Must Not Claim
35
-
36
- This skill must not claim ownership of:
37
-
38
- - domain-package data modeling and execution
39
- - Command Center-serving FastAPI contract and release design
40
- - jobs, schedules, images, resources, or releases
41
- - RBAC or sharing semantics
42
- - domain assets, translation tables, or construction logic
43
- - unsupported application deployment targets
44
- - pricing-runtime semantics
45
-
46
- Do not let this skill become a domain manual.
47
-
48
- ## Route Adjacent Work
49
-
50
- - MetaTables, table updates, and domain data discovery: use the installed
51
- `metatables` package skills and documentation
52
- - FastAPI APIs serving the Command Center frontend, and MCP tools and skills
53
- served from a FastAPI release:
54
- `.agents/skills/mainsequence/application_surfaces/api_surfaces/SKILL.md`
55
- - CodeRepository audits, blocker analysis, and upstream SDK assessment:
56
- `.agents/skills/mainsequence/maintenance/bug_auditor/SKILL.md`
57
- - local environment repair, CodeRepository authentication refresh, SDK updates,
58
- managed skill refresh, dependency sync, and publishing with Git:
8
+ Use this skill for SDK execution and CodeRepository integration. Follow the
9
+ repository's own instructions, including `AGENTS.md` when present. A repository
10
+ does not need that file to use the SDK or its skills, and the SDK does not
11
+ create, copy, update, or remove it.
12
+
13
+ ## Contract Authority
14
+
15
+ - Installed SDK code, CLI help, SDK skills, and version-matched documentation
16
+ define client behavior.
17
+ - Installed platform skills and backend-advertised schemas, templates, and
18
+ capabilities define the platform contract.
19
+ - Use the owning domain package and its installed skills before implementing
20
+ against an unfamiliar domain contract.
21
+ - Treat the public SDK documentation as supplemental when its version differs
22
+ from the installed package:
23
+ `https://mainsequence-sdk.github.io/mainsequence-sdk/`
24
+ - When the client and platform disagree, record the exact failing operation
25
+ and evidence with the bug-auditor skill. Do not guess or upgrade automatically.
26
+
27
+ ## Select The Relevant Skill
28
+
29
+ Use skill descriptions to select the domain involved in the request. This skill
30
+ is not a mandatory first step for maintenance, audits, or already-scoped domain
31
+ work. A platform design skill is useful when product architecture, ontology, or
32
+ the CodeRepository Blueprint is unresolved; select it from the installed
33
+ platform catalog rather than assuming its filesystem path.
34
+ Use that catalog to select platform-owned CodeRepository-to-Agent setup and
35
+ other platform capabilities as well.
36
+
37
+ - Environment repair, authentication, explicitly requested updates, dependency
38
+ sync, and Git publishing:
59
39
  `.agents/skills/mainsequence/maintenance/code_repository_maintenance/SKILL.md`
60
- - jobs, schedules, artifacts, images, resources, and releases:
40
+ - Failure classification and SDK/platform contract mismatches:
41
+ `.agents/skills/mainsequence/maintenance/bug_auditor/SKILL.md`
42
+ - FastAPI APIs serving Command Center, including MCP tools and skills:
43
+ `.agents/skills/mainsequence/application_surfaces/api_surfaces/SKILL.md`
44
+ - Jobs, schedules, images, resources, releases, and Artifacts:
61
45
  `.agents/skills/mainsequence/platform_operations/orchestration_and_releases/SKILL.md`
62
- - RBAC and sharing:
46
+ - RBAC, sharing, constants, secrets, and acting for a requester:
63
47
  `.agents/skills/mainsequence/platform_operations/access_control_and_sharing/SKILL.md`
64
- - direct recorded inference, structured extraction, thinking/provider controls,
65
- conversation history and safe replay:
48
+ - Recorded model calls, structured extraction, provider options, history, and replay:
66
49
  `.agents/skills/mainsequence/mainsequence-inference/SKILL.md`
67
- - TAU-based Harness Agent repository integration, local development, project
68
- customization, and runtime A2A adaptation: use the version-matched skills in
69
- `.agents/skills/ms_tau_sdk/` after the platform-owned skill defines the
70
- platform contract. If the namespace is absent, report it; synchronize it with
50
+ - A2A session discovery, messages, files, and SDK response handling:
51
+ `.agents/skills/mainsequence/a2a_sdk_execution/SKILL.md`
52
+ - Retired SDK MetaTables imports or commands:
53
+ `.agents/skills/mainsequence/maintenance/metatables_transition/SKILL.md`
54
+ - Current MetaTable modeling, queries, table updates, and Alembic changes:
55
+ use the installed `metatables` package's skills and documentation.
56
+ - TAU Harness Agent implementation: use the version-matched skills under
57
+ `.agents/skills/ms_tau_sdk/` after the relevant platform skill establishes
58
+ its contract. If those skills are missing, report that; run
71
59
  `uv run ms-tau skills sync --path .` only when the user requests that update.
72
60
 
73
- ## Read First
74
-
75
- 1. `AGENTS.md`
76
- 2. the relevant documentation for the installed SDK and current platform contract
77
-
78
- Canonical documentation root:
79
- `https://mainsequence-sdk.github.io/mainsequence-sdk/`
80
-
81
- ## Inputs This Skill Needs
82
-
83
- Before starting non-trivial work, collect or infer:
84
-
85
- - the user goal
86
- - the concrete success condition
87
- - the repository path and current code repository context
88
- - whether live platform verification is required
89
- - which specialized skill should own the domain behavior
90
-
91
- If the user goal or code repository context is unclear, stop before routing domain work.
92
-
93
- ## Resolve Local CodeRepository Context From Git
61
+ ## Resolve CodeRepository Context From Git
94
62
 
95
63
  The containing Git worktree is the only source of repository, attached branch,
96
64
  and exact commit identity. The SDK normalizes the non-secret repository remote,
97
- maps it to CodeRepository and CodeRepositoryBranch through the platform API, resolves once for
98
- the process, and reuses the immutable result. Authentication selects credentials
99
- and permissions; it does not select source identity. A `git switch` performed in
100
- a long-running process takes effect only in the next CLI invocation, worker,
101
- script, or other process run.
102
-
103
- Use `mainsequence code-repository current --debug --json` to verify that Git context resolves
104
- to `code_repository_branch_status=resolved` and a nonempty `code_repository_branch_uid`. The UID
105
- is an internal resolution result for branch-owned platform calls; it is not a
106
- local or environment configuration input. Never require the user to look it up,
107
- persist CodeRepository identity in `.env`, accept a branch environment override, or
108
- infer a branch from collection order. Local and deployed code repository images use the
109
- same Git algorithm. A detached checkout or an unregistered Git branch is
110
- unresolved context and must block only live branch-owned operations.
111
-
112
- Keep the platform boundaries explicit:
113
-
114
- - use the Git-resolved logical CodeRepository UID for aggregate identity and CodeRepository operations;
115
- - let the SDK resolve the current Git branch to CodeRepositoryBranch only when Jobs,
116
- images, releases, resources, pods, or other branch-owned APIs require it;
117
- - treat GitHubRepositoryBinding as repository metadata and clone-location ownership;
65
+ maps it to CodeRepository and CodeRepositoryBranch through the platform API,
66
+ resolves once for the process, and reuses the immutable result. Authentication
67
+ selects credentials and permissions; it does not select source identity.
68
+ A `git switch` in a long-running process takes effect in the next CLI invocation,
69
+ worker, script, or other process run.
70
+
71
+ For a live branch-owned operation, use
72
+ `mainsequence code-repository current --debug --json` to verify that Git context
73
+ resolves to `code_repository_branch_status=resolved` and a nonempty
74
+ `code_repository_branch_uid`. The UID is an internal resolution result, not a
75
+ local configuration input. Never ask the user to look it up, persist repository
76
+ identity in `.env`, accept a branch environment override, or infer a branch
77
+ from collection order. Local and deployed images use the same Git algorithm.
78
+
79
+ A detached checkout or an unregistered Git branch remains usable for ordinary
80
+ local development but has no resolved CodeRepositoryBranch or Environment.
81
+ Only operations requiring that context fail. Register the branch before
82
+ using branch-owned Jobs, images, releases, resources, pods, or other platform
83
+ APIs. Never fall back to another branch.
84
+
85
+ Keep these platform identities distinct:
86
+
87
+ - Git-resolved CodeRepository UID: aggregate identity and repository operations.
88
+ - CodeRepositoryBranch: resolved by the SDK when branch-owned APIs require it.
89
+ - GitHubRepositoryBinding: repository metadata and clone-location ownership;
118
90
  `git_ssh_url` is not CodeRepositoryBranch state.
119
91
 
120
- For ordinary local implementation, work naturally in the current Git branch.
121
- Do not make CodeRepositoryBranch selection a separate user workflow.
122
- An unregistered local branch remains valid for ordinary local development, but
123
- it has no CodeRepositoryBranch or Environment. Only branch-owned operations
124
- fail. Register the branch before using Jobs, images, releases, resources, pods,
125
- or other branch-owned platform APIs. Never fall back to another branch.
126
-
127
- ## Required Decisions
128
-
129
- For every non-trivial task, decide:
130
-
131
- 1. What does success look like in observable terms?
132
- 2. Which specialized skill owns the domain behavior?
133
- 3. Does platform state need live verification?
134
- 4. Are the docs and local implementation aligned, or is there a discrepancy to surface?
135
-
136
- ## Build Rules
137
-
138
- ### 1. Use the authority that owns the contract
139
-
140
- Use installed SDK skills, CLI help, and version-matched documentation for
141
- client behavior. Use installed platform-owned skills and backend-advertised
142
- schemas, templates, and capabilities for platform behavior. Treat the public
143
- documentation site as supplemental when it describes another SDK version. If
144
- the client and platform contracts disagree, stop and route the evidence to the
145
- bug-auditor skill instead of guessing or updating automatically.
146
-
147
- The `mainsequence` CLI owns `.agents/skills/mainsequence/`. It must not copy,
148
- refresh, or remove `.agents/skills/ms_tau_sdk/`; that independent namespace is
149
- owned by the installed `ms-tau-sdk` command.
150
-
151
- ### 2. Maintain the standard Main Sequence CodeRepository structure
152
-
153
- Also maintain these standard repository areas when relevant:
154
-
155
- - `src/`
156
- - `scripts/`
157
- - `tests/`
158
- - `docs/`
159
- - `api/`
160
-
161
- If the CodeRepository has recurring scheduled jobs or repository-managed releases,
162
- keep backend-managed declarations as direct `.yaml` or `.yml` children of
163
- `.mainsequence/workflows/`. Never create `scheduled_jobs.yaml`; retrieve and
164
- validate the current workflow contract through the backend-owned CodeRepositoryBranch
165
- workflow endpoints.
166
-
167
- Use the standard Main Sequence CodeRepository structure unless the repository explicitly documents a different layout.
168
-
169
- Repository-local execution paths for jobs must:
170
-
171
- - be relative to the repository root
172
- - use forward slashes, even on Windows
173
- - point to a supported file inside the repository
174
-
175
- Do not treat:
176
-
177
- - `.env` as long-term documentation
178
- - `.venv` as source code
179
- - local absolute paths as reusable repository instructions
180
-
181
- ### 3. Define success before implementation
182
-
183
- Make the end state explicit before changing code, docs, or platform objects.
184
-
185
- Do not start domain work with a vague target.
186
-
187
- ### 4. Verify code repository context before making platform claims
188
-
189
- Use the CLI to confirm the active CodeRepository and the saved session before live checks when needed.
190
-
191
- When the result will be consumed programmatically or used as machine-readable evidence, prefer the CLI `--json` flag.
192
-
193
- Typical bootstrap checks:
194
-
195
- - `mainsequence code-repository current --debug`
196
- - `mainsequence auth status --check`
197
- - `mainsequence refresh-token`
198
-
199
- The session lives in the operating system credential store, not in `.env`, and
200
- belongs to the machine, not to a checkout. `auth status` reports it without
201
- printing a token value. `refresh-token` renews it; run in a checkout, it also
202
- removes credential entries an earlier version left in `.env`.
203
-
204
- Do not proceed with a live branch-owned check unless `code-repository current` reports
205
- the current Git branch and a resolved CodeRepositoryBranch UID.
206
-
207
- ### 5. Route domain work instead of expanding the bootstrap skill
208
-
209
- Once the task boundary is clear, move into the correct specialized skill.
210
-
211
- Do not teach domain semantics here.
92
+ ## Use The Installed CLI
212
93
 
213
- ## Review Rules
94
+ Use `mainsequence` as the default platform control surface for SDK-supported
95
+ operations. Prefer `--json` when parsing output or collecting evidence. Check
96
+ installed command help when documentation and local behavior differ.
214
97
 
215
- When reviewing bootstrap behavior, look for:
98
+ Before live platform checks, inspect the saved session with
99
+ `mainsequence auth status --check` when needed. Authentication belongs to the
100
+ machine, not to a checkout. The SDK reads the saved operating-system credential
101
+ store session; credentials must not be copied into repository instructions.
216
102
 
217
- - domain work happening without a clear owner skill
218
- - implementation starting without a concrete success condition
219
- - platform claims made without verification
220
- - docs mismatches that were noticed but not surfaced
221
- - the bootstrap skill growing back into a catch-all domain manual
103
+ Verify only the platform objects relevant to the requested outcome. Separate
104
+ verified facts from assumptions, and state any live checks that could not be
105
+ performed.
222
106
 
223
- ## Validation Checklist
107
+ ## SDK Skills And Repository Files
224
108
 
225
- Do not claim bootstrap success until you have checked:
109
+ The SDK owns `.agents/skills/mainsequence/`. Its copier installs SDK guidance
110
+ and domain skills together from the target repository's installed package,
111
+ removes retired files, and writes `PINNED_FROM.txt` with the installed version.
112
+ SDK skill copying needs no sign-in or platform catalog.
226
113
 
227
- - the correct code repository context is selected
228
- - the relevant docs were checked
229
- - the success condition is explicit
230
- - the correct specialized skill was chosen
231
- - any platform-state claims were verified with CLI or platform tooling
114
+ An explicit `update-sdk` also refreshes SDK skills after installing the package.
115
+ Other skill refreshes require the user's request; a stale or missing sentinel
116
+ is a condition to report, not permission to update. Use the maintenance skill
117
+ for the update workflow.
232
118
 
233
- ## This Skill Must Stop And Escalate When
119
+ Platform skills belong to `.agents/skills/mainsequence_platform/` and use the
120
+ authenticated platform updater. Other libraries, including `metatables` and
121
+ `ms-tau-sdk`, own their independent namespaces and update commands.
234
122
 
235
- - the relevant docs cannot be accessed
236
- - the code repository context is unclear
237
- - the success condition is still ambiguous
238
- - live platform state is required but has not been verified
239
- - domain work is proceeding without the relevant specialized skill or docs
123
+ Follow the repository's existing layout. The SDK does not require `src/`,
124
+ `scripts/`, `tests/`, `docs/`, or `api/` directories merely because it is
125
+ installed. When recurring Jobs or releases use backend-managed workflow
126
+ declarations, keep their YAML files as direct children of
127
+ `.mainsequence/workflows/` and validate the current backend workflow contract.
240
128
 
241
- Do not guess through missing context.
129
+ Repository-local execution paths passed to platform Jobs must be relative to
130
+ the repository root, use forward slashes on every operating system, and refer
131
+ to supported files inside the checkout.
mainsequence/cli/cli.py CHANGED
@@ -1059,117 +1059,6 @@ def _resolve_installed_agent_scaffold_skill(skill_name: str) -> dict[str, pathli
1059
1059
  raise typer.Exit(1)
1060
1060
 
1061
1061
 
1062
- AGENTS_MD_MANAGED_BLOCK_START_PREFIX = "<!-- mainsequence-agent-scaffold:start"
1063
- AGENTS_MD_MANAGED_BLOCK_END = "<!-- mainsequence-agent-scaffold:end -->"
1064
- AGENTS_MD_MANAGED_BLOCK_SCHEMA = "1"
1065
- AGENTS_MD_MANAGED_BLOCK_START_LINE_RE = re.compile(
1066
- rf"(?m)^[ \t]*{re.escape(AGENTS_MD_MANAGED_BLOCK_START_PREFIX)}\b[^\n]*-->[ \t]*$"
1067
- )
1068
- AGENTS_MD_MANAGED_BLOCK_END_LINE_RE = re.compile(
1069
- rf"(?m)^[ \t]*{re.escape(AGENTS_MD_MANAGED_BLOCK_END)}[ \t]*$"
1070
- )
1071
-
1072
-
1073
- @dataclasses.dataclass(frozen=True)
1074
- class AgentsMdManagedBlockUpdate:
1075
- action: str
1076
- changed: bool
1077
-
1078
-
1079
- def _installed_agent_scaffold_agents_md_file() -> pathlib.Path:
1080
- source = _installed_agent_scaffold_bundle_dir() / "AGENTS.md"
1081
- if not source.is_file():
1082
- error(f"Installed agent_scaffold bundle is missing {source.name}: {source}")
1083
- raise typer.Exit(1)
1084
- return source
1085
-
1086
-
1087
- def _agents_md_managed_block_line_matches(
1088
- source_content: str,
1089
- ) -> tuple[list[re.Match[str]], list[re.Match[str]]]:
1090
- start_matches = list(AGENTS_MD_MANAGED_BLOCK_START_LINE_RE.finditer(source_content))
1091
- end_matches = list(AGENTS_MD_MANAGED_BLOCK_END_LINE_RE.finditer(source_content))
1092
- return start_matches, end_matches
1093
-
1094
-
1095
- def _extract_agents_md_managed_block(source_content: str) -> str:
1096
- start_matches, end_matches = _agents_md_managed_block_line_matches(source_content)
1097
- if len(start_matches) != 1 or len(end_matches) != 1:
1098
- raise ValueError(
1099
- "Installed agent_scaffold AGENTS.md must contain exactly one Main Sequence "
1100
- "managed block."
1101
- )
1102
-
1103
- start_match = start_matches[0]
1104
- end_match = end_matches[0]
1105
- if end_match.start() < start_match.start():
1106
- raise ValueError(
1107
- "Installed agent_scaffold AGENTS.md contains malformed Main Sequence managed "
1108
- "block markers."
1109
- )
1110
-
1111
- return source_content[start_match.start() : end_match.end()]
1112
-
1113
-
1114
- def _load_installed_agents_md_template() -> tuple[pathlib.Path, str, str]:
1115
- source = _installed_agent_scaffold_agents_md_file()
1116
- content = source.read_text(encoding="utf-8")
1117
- managed_block = _extract_agents_md_managed_block(content)
1118
- return source, content, managed_block
1119
-
1120
-
1121
- def _apply_agents_md_managed_block(
1122
- content: str,
1123
- bootstrap_content: str,
1124
- managed_block: str,
1125
- ) -> tuple[str, str]:
1126
- start_matches, end_matches = _agents_md_managed_block_line_matches(content)
1127
-
1128
- if len(start_matches) > 1 or len(end_matches) > 1:
1129
- raise ValueError(
1130
- "AGENTS.md contains multiple Main Sequence managed block markers; resolve it manually."
1131
- )
1132
- if len(start_matches) != len(end_matches):
1133
- raise ValueError(
1134
- "AGENTS.md contains malformed Main Sequence managed block markers; resolve it manually."
1135
- )
1136
-
1137
- if not start_matches:
1138
- return bootstrap_content, "replaced"
1139
-
1140
- start_match = start_matches[0]
1141
- end_match = end_matches[0]
1142
- if end_match.start() < start_match.start():
1143
- raise ValueError(
1144
- "AGENTS.md contains malformed Main Sequence managed block markers; resolve it manually."
1145
- )
1146
-
1147
- updated = (
1148
- f"{content[: start_match.start()]}{managed_block.rstrip()}{content[end_match.end() :]}"
1149
- )
1150
- action = "unchanged" if updated == content else "updated"
1151
- return updated, action
1152
-
1153
-
1154
- def _update_agents_md_managed_block_file(
1155
- destination: pathlib.Path,
1156
- bootstrap_content: str,
1157
- managed_block: str,
1158
- ) -> AgentsMdManagedBlockUpdate:
1159
- destination.parent.mkdir(parents=True, exist_ok=True)
1160
-
1161
- if not destination.exists():
1162
- destination.write_text(bootstrap_content, encoding="utf-8")
1163
- return AgentsMdManagedBlockUpdate(action="created", changed=True)
1164
-
1165
- original = destination.read_text(encoding="utf-8")
1166
- updated, action = _apply_agents_md_managed_block(original, bootstrap_content, managed_block)
1167
- changed = updated != original
1168
- if changed:
1169
- destination.write_text(updated, encoding="utf-8")
1170
- return AgentsMdManagedBlockUpdate(action=action, changed=changed)
1171
-
1172
-
1173
1062
  def _parse_env_var_entries(entries: list[str]) -> dict[str, str]:
1174
1063
  """
1175
1064
  Parse env var entries from repeated KEY=VALUE args and/or comma-separated chunks.
@@ -7698,84 +7587,6 @@ def code_repository_update_sdk(
7698
7587
  success("SDK update and SDK skill refresh complete.")
7699
7588
 
7700
7589
 
7701
- @code_repository.command("update")
7702
- def code_repository_update_scaffold_target(
7703
- target: str = typer.Argument(
7704
- ..., help="Scaffold target to update. Currently supported: AGENTS.md"
7705
- ),
7706
- code_repository_id: str | None = typer.Option(
7707
- None,
7708
- "--code-repository-uid",
7709
- help="Optional CodeRepository UID assertion against the current Git worktree",
7710
- ),
7711
- path: str | None = typer.Option(None, "--path", help="CodeRepository directory"),
7712
- ):
7713
- """
7714
- Update a scaffold-managed file in the local CodeRepository root.
7715
-
7716
- Currently this command supports only `AGENTS.md`.
7717
- If the Main Sequence managed marker is present, only that block is updated.
7718
- If the marker is absent, the whole file is replaced from the installed
7719
- scaffold template.
7720
-
7721
- Examples
7722
- --------
7723
- ```bash
7724
- mainsequence code-repository update AGENTS.md
7725
- mainsequence code-repository update AGENTS.md --path .
7726
- mainsequence code-repository update AGENTS.md --code-repository-uid code-repository-uid-123
7727
- ```
7728
- """
7729
- if target != "AGENTS.md":
7730
- error(f"Unsupported scaffold update target: {target}. Supported target: AGENTS.md")
7731
- raise typer.Exit(1)
7732
-
7733
- code_repository_dir = _resolve_code_repository_dir(code_repository_id, path)
7734
- destination = code_repository_dir / "AGENTS.md"
7735
-
7736
- try:
7737
- source, bootstrap_content, managed_block = _load_installed_agents_md_template()
7738
- update_result = _update_agents_md_managed_block_file(
7739
- destination,
7740
- bootstrap_content,
7741
- managed_block,
7742
- )
7743
- except ValueError as exc:
7744
- error(str(exc))
7745
- raise typer.Exit(1) from exc
7746
-
7747
- payload = {
7748
- "target": target,
7749
- "code_repository": code_repository_dir,
7750
- "source": source,
7751
- "destination": destination,
7752
- "action": update_result.action,
7753
- "changed": update_result.changed,
7754
- "overwritten": False,
7755
- "managed_block": {
7756
- "start": AGENTS_MD_MANAGED_BLOCK_START_PREFIX,
7757
- "end": AGENTS_MD_MANAGED_BLOCK_END,
7758
- },
7759
- }
7760
- if _emit_json(payload):
7761
- return
7762
-
7763
- if update_result.action == "unchanged":
7764
- success(f"{target} Main Sequence managed block already current.")
7765
- else:
7766
- success(f"Updated scaffold-managed {target}.")
7767
- print_kv(
7768
- "Scaffold Update",
7769
- [
7770
- ("Target", target),
7771
- ("Action", update_result.action),
7772
- ("CodeRepository", str(code_repository_dir)),
7773
- ("Source", str(source)),
7774
- ("Destination", str(destination)),
7775
- ],
7776
- )
7777
-
7778
-
7779
7590
  @code_repository.command("update-agent-skills")
7780
7591
  def code_repository_update_agent_skills(
7781
7592
  code_repository_id: str | None = typer.Option(
@@ -7791,8 +7602,8 @@ def code_repository_update_agent_skills(
7791
7602
  No sign-in or backend access is required unless a CodeRepository UID
7792
7603
  assertion is supplied. The SDK owns all of .agents/skills/mainsequence:
7793
7604
  files and folders absent from the installed bundle are deleted. Other
7794
- namespaces are untouched. AGENTS.md is refreshed separately with
7795
- code-repository update AGENTS.md. Platform skills use update-platform-skills.
7605
+ namespaces and repository-owned AGENTS.md are untouched. SDK instructions
7606
+ ship inside the skills. Platform skills use update-platform-skills.
7796
7607
 
7797
7608
  Examples
7798
7609
  --------
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mainsequence
3
- Version: 9.0.23.dev66
3
+ Version: 9.0.24.dev67
4
4
  Summary: Main Sequence SDK
5
5
  Author-email: Main Sequence GmbH <dev@main-sequence.io>
6
6
  License-Expression: MIT
@@ -82,7 +82,8 @@ Main package areas:
82
82
 
83
83
  Repository areas:
84
84
 
85
- - `agent_scaffold/`: version-matched SDK skills and managed `AGENTS.md` content
85
+ - `agent_scaffold/skills/`: version-matched SDK guidance and domain skills;
86
+ repository-owned `AGENTS.md` files are never scaffolded or updated
86
87
  - `docs/`: knowledge guides, CLI docs, architecture decisions, and generated
87
88
  reference docs
88
89
  - `tests/`: offline tests plus explicitly marked live-backend tests
@@ -1,13 +1,12 @@
1
- agent_scaffold/AGENTS.md,sha256=Y_alRuPiX82gfu1ChPCOtBMvF44YiWr4wHxUq3hL43w,6529
2
1
  agent_scaffold/skills/a2a_sdk_execution/SKILL.md,sha256=NcwIQ1QgD4Ku0mG2Hb-Izee8p9fm9LTPHa6gDEWTOSQ,13200
3
2
  agent_scaffold/skills/application_surfaces/api_surfaces/SKILL.md,sha256=gdoe860TEQyrMIVcN1L3Cf8lBYv3ErMkTNWcNrWjOKo,24427
4
3
  agent_scaffold/skills/mainsequence-inference/SKILL.md,sha256=yv8aAHLQ2FBBSWPIFadY7pGNTwtR-yiR_-UzaGRN9-g,12502
5
- agent_scaffold/skills/maintenance/bug_auditor/SKILL.md,sha256=CCKs7edyZ9RK-WtAgXJXucokJFXZxk8sRUe0_imFtu8,8610
6
- agent_scaffold/skills/maintenance/code_repository_maintenance/SKILL.md,sha256=vJ7ksmqvgjdQGS3QYGb6oD7HaRi5LNIo1PYKTEV_eyU,18283
4
+ agent_scaffold/skills/maintenance/bug_auditor/SKILL.md,sha256=8RRZNmC3omhZoxNbmu50MdhBFTQ2CU2THeyNu07Ax18,8659
5
+ agent_scaffold/skills/maintenance/code_repository_maintenance/SKILL.md,sha256=pNQICoVW6nRr0HfvyB0Q64TdsqCXTWQUuImpBL-4XUQ,18575
7
6
  agent_scaffold/skills/maintenance/metatables_transition/SKILL.md,sha256=PisgpytcksJnfZMS6aiPCmahsT3fm8DIwk_cefXA2qU,3759
8
- agent_scaffold/skills/platform_operations/access_control_and_sharing/SKILL.md,sha256=rB_52v63tR5dptYYviaAHzYmnhLPgWsex2lpZkYDDuk,14765
9
- agent_scaffold/skills/platform_operations/orchestration_and_releases/SKILL.md,sha256=_84nnJKl_w-JrcbiTIairbFf9ptoQvW5Y1kMxn_XzkU,16871
10
- agent_scaffold/skills/sdk_code_repository_execution/SKILL.md,sha256=_CzYF7p0slC8m9oeKgGbWjCjvXW607SCCFC8dClujtE,10254
7
+ agent_scaffold/skills/platform_operations/access_control_and_sharing/SKILL.md,sha256=hDXkctBgMsd_pJYmAq7lR8M_zulIAmgYVx1ii5qBcp0,14814
8
+ agent_scaffold/skills/platform_operations/orchestration_and_releases/SKILL.md,sha256=KfTptbOMO-b8hiVFPgKxRMjmQWZCLB9Sr_kli7kp4hs,16920
9
+ agent_scaffold/skills/sdk_code_repository_execution/SKILL.md,sha256=g4C0Cp5oqQg2LBjT-piWXunmt_hNd5yTK33RMYPAE8I,7313
11
10
  mainsequence/__init__.py,sha256=70CbIo7ZG1mzi5uwkqDtVESunBE0RanHjeFg4ptfsA0,385
12
11
  mainsequence/__main__.py,sha256=KuAP69uduS2ImrPIgNMzbGBRepZzjqvUONu5vFh4v4A,176
13
12
  mainsequence/_request_identity.py,sha256=vsbnQeJ9ycRB2p8oFTUxfPkzDh7-SBQ5Pxzn04pjqVM,4183
@@ -24,7 +23,7 @@ mainsequence/scaffold_skills.py,sha256=k0V6eKC5AwbHr9wB9UGMJNF-8eJ0_1izF4-BU01KH
24
23
  mainsequence/cli/__init__.py,sha256=sMWTnomCaISjnureLuXFRqOzkH2Y77uYEivsd-M6_8Y,28
25
24
  mainsequence/cli/api.py,sha256=u3vjwJ5w_u4o76ufkePXKIh6dixOHDok_r8Os0iA_04,128865
26
25
  mainsequence/cli/browser_auth.py,sha256=Vb5MBOnPC05HLZzVNUDODobJ_p5wEIzH_h8rIlpShlE,9984
27
- mainsequence/cli/cli.py,sha256=4t0vf-gi_Ez4MjvAEOAfGYwVuSxb1HECRRyaruQvp6M,269468
26
+ mainsequence/cli/cli.py,sha256=PPc3cWvESPZ0gNfj1ktDBaYIcniguL9yAIWOFaNMrLE,262839
28
27
  mainsequence/cli/code_repository_status.py,sha256=SHEnU8YSWFowPG6dEdE4Yd8CS1tIcJSE1MXFLfvD3Os,5975
29
28
  mainsequence/cli/config.py,sha256=TJYnM11kg5pH2O7AGWFLpNEkC9UEu0g7k2RLjhAHCzo,45724
30
29
  mainsequence/cli/docker_utils.py,sha256=eAnp9MI042cHWwKasA5IF2I7INL3A6tV2JX-cSIe7rc,10687
@@ -58,9 +57,9 @@ mainsequence/server/mcp_skills.py,sha256=-krRwAHCAMipScgGJ19uVkzznhTop1Nz4C_wRY1
58
57
  mainsequence/server/_mcp_skills_upstream/__init__.py,sha256=px283qBMf3z1nxCfN3WHrH9v8Y8jOb1xoBqZMRZcaD8,2694
59
58
  mainsequence/server/_mcp_skills_upstream/server.py,sha256=laHsfpoaYX3LcwQ04-GN7r0_C63fG6CzyXDci2rmbHE,7695
60
59
  mainsequence/server/_mcp_skills_upstream/shared.py,sha256=JmnX9PoLoyi93nBYnUEPWCdPXor_nQHjHptQDXpFzPs,11978
61
- mainsequence-9.0.23.dev66.dist-info/licenses/LICENSE,sha256=b6Ecsk8wjsEby3lbSzdljR6hHiFGHBizt9iWV2p1c_I,1074
62
- mainsequence-9.0.23.dev66.dist-info/METADATA,sha256=wt6keqLEOGf1mggNThtqGuZ-O6fh7s_6SnT0O-9H51k,7466
63
- mainsequence-9.0.23.dev66.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
64
- mainsequence-9.0.23.dev66.dist-info/entry_points.txt,sha256=XGAOq3-mF2lWWpeRJvoaWyMarRcK167mH1g124aGdUs,88
65
- mainsequence-9.0.23.dev66.dist-info/top_level.txt,sha256=BFeblM_Q9q0cUWBvTxnfWcWQEHtf5XZi9nOS-Gdfwus,28
66
- mainsequence-9.0.23.dev66.dist-info/RECORD,,
60
+ mainsequence-9.0.24.dev67.dist-info/licenses/LICENSE,sha256=b6Ecsk8wjsEby3lbSzdljR6hHiFGHBizt9iWV2p1c_I,1074
61
+ mainsequence-9.0.24.dev67.dist-info/METADATA,sha256=9xRrpjtRTzI9nv1EEHAtY2iVu8e_gOy5BR1UQABgN-E,7531
62
+ mainsequence-9.0.24.dev67.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
63
+ mainsequence-9.0.24.dev67.dist-info/entry_points.txt,sha256=XGAOq3-mF2lWWpeRJvoaWyMarRcK167mH1g124aGdUs,88
64
+ mainsequence-9.0.24.dev67.dist-info/top_level.txt,sha256=BFeblM_Q9q0cUWBvTxnfWcWQEHtf5XZi9nOS-Gdfwus,28
65
+ mainsequence-9.0.24.dev67.dist-info/RECORD,,
agent_scaffold/AGENTS.md DELETED
@@ -1,122 +0,0 @@
1
- # AGENTS.md
2
-
3
- You are a dual-mandate agent. Follow the repository-specific instructions in this file and the
4
- relevant skills, while also keeping in mind that application surfaces, data, and implementation
5
- operate within the Main Sequence platform and must follow Main Sequence platform instructions.
6
-
7
- ## Repository-Specific Instructions
8
-
9
- [ HERE SHOULD BE THE REPOSITORY-SPECIFIC ACTIONS, RULES, CONTEXT, AND LOCAL NOTES. DO NOT REMOVE
10
- THIS LINE UNLESS YOU REPLACE IT WITH REAL REPOSITORY-SPECIFIC CONTENT. ]
11
-
12
- Do not remove the `<!-- mainsequence-agent-scaffold:start schema=1 source=agent_scaffold -->`
13
- or `<!-- mainsequence-agent-scaffold:end -->` markers. `mainsequence code-repository update AGENTS.md`
14
- uses them to update only the Main Sequence section below.
15
-
16
-
17
- <!-- mainsequence-agent-scaffold:start schema=1 source=agent_scaffold -->
18
- ## Main Sequence Instructions
19
-
20
- Use this managed section to select the correct Main Sequence skill. Detailed
21
- procedures belong in those skills and their referenced documentation.
22
-
23
- ## Authority
24
-
25
- - Repository-specific instructions above this block define local intent and
26
- repository conventions.
27
- - The installed SDK code, CLI help, SDK-owned skills, and version-matched SDK
28
- documentation define client behavior.
29
- - Installed platform-owned skills and backend-advertised schemas, templates,
30
- and capabilities define the current platform contract.
31
- - The public documentation site is supplemental when its SDK version differs
32
- from the installed package:
33
- `https://mainsequence-sdk.github.io/mainsequence-sdk/`
34
- - If the installed client and platform contract disagree, do not guess or
35
- update automatically. Use the bug-auditor skill to record the evidence and
36
- identify the owning side.
37
-
38
- ## Updates Are Explicit
39
-
40
- Do not run any of these commands unless the user explicitly requests that
41
- specific update:
42
-
43
- - `mainsequence code-repository update-sdk --path .`
44
- - `mainsequence code-repository update-agent-skills --path .`
45
- - `mainsequence code-repository update-platform-skills --path .`
46
- - `mainsequence code-repository update AGENTS.md --path .`
47
- - `uv run ms-tau skills sync --path .`
48
-
49
- A missing or mismatched `.agents/skills/mainsequence/PINNED_FROM.txt` is state
50
- to report, not permission to mutate the repository. The same rule applies to
51
- `.agents/skills/ms_tau_sdk/PINNED_FROM.txt`. When a Main Sequence update is
52
- requested, use the `code_repository_maintenance` skill. The `mainsequence` CLI
53
- never owns or updates the `ms_tau_sdk` namespace.
54
-
55
- The SDK owns all of `.agents/skills/mainsequence/`. Its skill copy is local,
56
- requires no sign-in, and deletes everything absent from the installed SDK
57
- bundle. Platform skills are installed separately under
58
- `.agents/skills/mainsequence_platform/` by the authenticated platform update.
59
-
60
- ## Route By Task
61
-
62
- - Product architecture, platform ontology, and CodeRepository Blueprint work:
63
- use the matching platform-owned design skill declared by the installed
64
- platform catalog. Do not assume its filesystem path.
65
- - CodeRepository context, local SDK execution, repository structure, and
66
- implementation routing:
67
- `.agents/skills/mainsequence/sdk_code_repository_execution/SKILL.md`
68
- - Local environment repair, authentication, explicitly requested updates,
69
- dependency sync after a dependency change, and publishing with Git:
70
- `.agents/skills/mainsequence/maintenance/code_repository_maintenance/SKILL.md`
71
- - Blocker analysis, failure classification, and SDK/platform contract mismatches:
72
- `.agents/skills/mainsequence/maintenance/bug_auditor/SKILL.md`
73
- - MetaTable modeling, queries, external registration, table updates, Alembic
74
- schema changes, and data discovery: use the skills the `metatables` package
75
- installs under `.agents/skills/metatables/` and its documentation.
76
- - Code that still imports `mainsequence.meta_tables` or
77
- `mainsequence.client.metatables`, or calls the retired `mainsequence` table
78
- and migration commands:
79
- `.agents/skills/mainsequence/maintenance/metatables_transition/SKILL.md`
80
- - FastAPI APIs serving the Command Center frontend, and MCP tools and skills
81
- served from a FastAPI release:
82
- `.agents/skills/mainsequence/application_surfaces/api_surfaces/SKILL.md`
83
- - Jobs, schedules, images, resources, releases, and Artifacts:
84
- `.agents/skills/mainsequence/platform_operations/orchestration_and_releases/SKILL.md`
85
- - RBAC, sharing, constants, secrets, access verification, and whether an
86
- application uses its own grants or acts for its requester:
87
- `.agents/skills/mainsequence/platform_operations/access_control_and_sharing/SKILL.md`
88
- - Direct recorded model calls, structured extraction, thinking/provider options,
89
- inference history and idempotent replay:
90
- `.agents/skills/mainsequence/mainsequence-inference/SKILL.md`
91
- - A2A session discovery, messages, files, and SDK response handling:
92
- `.agents/skills/mainsequence/a2a_sdk_execution/SKILL.md`
93
- - Turning a CodeRepository into a platform coding agent or selecting other
94
- platform-owned capabilities: use the matching skill declared by the installed
95
- platform catalog. Do not hardcode a platform-owned skill path.
96
- - Implementing or debugging a TAU-based Harness Agent: after the platform skill
97
- establishes the platform contract, use the version-matched skills under
98
- `.agents/skills/ms_tau_sdk/`. If they are absent and the user requested the
99
- update, run `uv run ms-tau skills sync --path .`; do not reconstruct those
100
- SDK instructions from platform documentation.
101
-
102
- ## Core Working Rules
103
-
104
- - Read the relevant skill before acting on a Main Sequence domain.
105
- - Use the current Git checkout as repository, branch, and commit identity. Do
106
- not ask users to inject CodeRepositoryBranch or Environment identity.
107
- - Use the `mainsequence` CLI as the default platform control surface. Prefer
108
- `--json` when output will be parsed or used as evidence.
109
- - Use the owning domain package before designing against an unfamiliar domain contract.
110
- - Keep reusable business logic under `src/` and keep API, job, and other
111
- integration layers thin.
112
- - Verify only the platform objects relevant to the requested outcome.
113
- - Separate verified facts from assumptions and report blockers with the exact
114
- failing operation.
115
-
116
- ## Completion
117
-
118
- Before implementation, identify the requested end state and the evidence that
119
- will prove it. Do not claim completion until the relevant code or documentation
120
- checks pass and any required platform state has been verified. If live
121
- verification is unavailable, state what remains unverified.
122
- <!-- mainsequence-agent-scaffold:end -->