@echopath-labs/forgerail 0.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/.codex-plugin/plugin.json +37 -0
  2. package/CHANGELOG.md +17 -0
  3. package/CONTRIBUTING.md +7 -0
  4. package/LICENSE +201 -0
  5. package/NOTICE +4 -0
  6. package/PLUGIN.md +11 -0
  7. package/README.md +65 -0
  8. package/README.zh-CN.md +39 -0
  9. package/SECURITY.md +7 -0
  10. package/adapters/claude-code.json +20 -0
  11. package/adapters/codex.json +20 -0
  12. package/adapters/cursor.json +20 -0
  13. package/contracts/adoption-plan.schema.json +53 -0
  14. package/contracts/capability-pack.schema.json +23 -0
  15. package/contracts/effective-profile.schema.json +42 -0
  16. package/contracts/host-adapter.schema.json +43 -0
  17. package/contracts/host-binding-receipt.schema.json +47 -0
  18. package/contracts/launch-contract.schema.json +15 -0
  19. package/contracts/profile-change-candidate.schema.json +21 -0
  20. package/contracts/return-receipt.schema.json +23 -0
  21. package/contracts/task-envelope.schema.json +21 -0
  22. package/docs/adoption.md +51 -0
  23. package/docs/adoption.zh-CN.md +51 -0
  24. package/docs/agw-coverage-baseline.json +21 -0
  25. package/docs/agw-coverage-baseline.md +21 -0
  26. package/docs/agw-frozen-baseline.json +51 -0
  27. package/docs/architecture-acceptance.md +38 -0
  28. package/docs/context-cost.md +13 -0
  29. package/docs/external-capability-packs.md +25 -0
  30. package/docs/installation.md +88 -0
  31. package/docs/installation.zh-CN.md +60 -0
  32. package/docs/migration-from-agw.md +12 -0
  33. package/docs/pack-authoring.md +17 -0
  34. package/docs/release.md +50 -0
  35. package/docs/release.zh-CN.md +50 -0
  36. package/package.json +48 -0
  37. package/packs/workspace-health-review.json +15 -0
  38. package/scripts/disposable-consumer.mjs +143 -0
  39. package/scripts/fixtures/contracts/adoption-plan.multi-host.valid.json +44 -0
  40. package/scripts/fixtures/contracts/adoption-plan.mutating.invalid.json +18 -0
  41. package/scripts/fixtures/contracts/adoption-plan.single-host.valid.json +27 -0
  42. package/scripts/fixtures/contracts/effective-profile.valid.json +29 -0
  43. package/scripts/fixtures/contracts/host-adapter.claude-code.profile-only.valid.json +14 -0
  44. package/scripts/fixtures/contracts/host-adapter.codex.valid.json +17 -0
  45. package/scripts/fixtures/contracts/host-adapter.cursor.profile-only.valid.json +14 -0
  46. package/scripts/fixtures/contracts/host-binding-receipt.unverified.invalid.json +27 -0
  47. package/scripts/fixtures/contracts/host-binding-receipt.valid.json +27 -0
  48. package/scripts/fixtures/contracts/launch-contract.valid.json +19 -0
  49. package/scripts/fixtures/contracts/profile-change-candidate.valid.json +13 -0
  50. package/scripts/fixtures/contracts/profile-input.available-pack.json +26 -0
  51. package/scripts/fixtures/contracts/profile-input.conflict.json +20 -0
  52. package/scripts/fixtures/contracts/profile-input.external-rulesets.json +11 -0
  53. package/scripts/fixtures/contracts/profile-input.orchestration-available.json +11 -0
  54. package/scripts/fixtures/contracts/return-receipt.deviation.invalid.json +15 -0
  55. package/scripts/fixtures/contracts/return-receipt.valid.json +15 -0
  56. package/scripts/fixtures/contracts/task-envelope.overlap.invalid.json +13 -0
  57. package/scripts/fixtures/contracts/task-envelope.valid.json +13 -0
  58. package/scripts/fixtures/workspaces/empty-records/README.md +3 -0
  59. package/scripts/fixtures/workspaces/markdown-existing/AGENTS.md +3 -0
  60. package/scripts/fixtures/workspaces/markdown-existing/docs/adr/0001-record-strategy.md +3 -0
  61. package/scripts/fixtures/workspaces/markdown-existing/package.json +7 -0
  62. package/scripts/forgerail.mjs +210 -0
  63. package/scripts/lib/adoption.mjs +158 -0
  64. package/scripts/lib/bundle.mjs +77 -0
  65. package/scripts/lib/composition.mjs +96 -0
  66. package/scripts/lib/contracts.mjs +316 -0
  67. package/scripts/lib/diagnosis.mjs +93 -0
  68. package/scripts/shadow-comparison.mjs +98 -0
  69. package/scripts/validate-external-packs.mjs +27 -0
  70. package/scripts/validate-release.mjs +194 -0
  71. package/skills/forgerail/SKILL.md +53 -0
  72. package/skills/forgerail/agents/openai.yaml +7 -0
  73. package/skills/forgerail/references/adoption.md +13 -0
  74. package/skills/forgerail/references/contracts.md +57 -0
  75. package/skills/forgerail/references/profile-resolution.md +14 -0
  76. package/skills/forgerail-workspace-diagnosis/SKILL.md +42 -0
  77. package/skills/forgerail-workspace-diagnosis/agents/openai.yaml +7 -0
  78. package/skills/forgerail-workspace-diagnosis/references/record-strategies.md +13 -0
  79. package/skills/workspace-health-review/SKILL.md +27 -0
  80. package/skills/workspace-health-review/agents/openai.yaml +7 -0
  81. package/skills/workspace-health-review/references/health-review.md +21 -0
  82. package/templates/FORGERAIL.md +15 -0
  83. package/templates/bindings/claude-code-thin.md +5 -0
  84. package/templates/bindings/codex-compact.md +5 -0
  85. package/templates/bindings/codex-thin.md +5 -0
  86. package/templates/bindings/cursor-thin.mdc +7 -0
@@ -0,0 +1,194 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { existsSync, readFileSync } from "node:fs";
4
+ import { dirname, resolve } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+
7
+ const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
8
+ const expectedPackageName = "@echopath-labs/forgerail";
9
+ const expectedVersion = "0.1.0-alpha.1";
10
+ const expectedTag = `v${expectedVersion}`;
11
+ const expectedDate = "2026-08-13";
12
+ const expectedPlugins = [
13
+ "forgerail",
14
+ "forgerail-cross-workspace-orchestration",
15
+ "forgerail-github-rulesets",
16
+ "forgerail-release-safety",
17
+ "forgerail-thread-closure",
18
+ ];
19
+ const checks = [];
20
+
21
+ function record(id, passed, detail) {
22
+ checks.push({ id, passed, detail });
23
+ }
24
+
25
+ function read(path) {
26
+ return readFileSync(resolve(root, path), "utf8");
27
+ }
28
+
29
+ function json(path) {
30
+ return JSON.parse(read(path));
31
+ }
32
+
33
+ function findExisting(candidates) {
34
+ const path = candidates.find((candidate) => existsSync(resolve(root, candidate)));
35
+ if (!path) throw new Error(`none of the expected paths exist: ${candidates.join(", ")}`);
36
+ return path;
37
+ }
38
+
39
+ const packageJson = json("package.json");
40
+ const packageLock = json("package-lock.json");
41
+ record("package-name", packageJson.name === expectedPackageName, packageJson.name);
42
+ record("package-lock-name", packageLock.name === expectedPackageName && packageLock.packages?.[""]?.name === expectedPackageName, packageLock.name);
43
+ record("package-version", packageJson.version === expectedVersion, packageJson.version);
44
+ record("package-lock-version", packageLock.version === expectedVersion && packageLock.packages?.[""]?.version === expectedVersion, packageLock.version);
45
+ record("package-license", packageJson.license === "Apache-2.0", packageJson.license);
46
+ record("package-lock-license", packageLock.packages?.[""]?.license === "Apache-2.0", packageLock.packages?.[""]?.license ?? null);
47
+ record("npm-next-tag", packageJson.publishConfig?.tag === "next", packageJson.publishConfig?.tag ?? null);
48
+ record(
49
+ "prepublish-gate",
50
+ ["npm test", "npm run test:shadow", "npm run test:release", "npm run test:consumer"].every((command) => packageJson.scripts?.prepublishOnly?.includes(command)),
51
+ packageJson.scripts?.prepublishOnly ?? null,
52
+ );
53
+
54
+ const pluginPaths = {
55
+ forgerail: ".codex-plugin/plugin.json",
56
+ "forgerail-cross-workspace-orchestration": findExisting([
57
+ "../forgerail-cross-workspace-orchestration/.codex-plugin/plugin.json",
58
+ "plugins/forgerail-cross-workspace-orchestration/.codex-plugin/plugin.json",
59
+ ]),
60
+ "forgerail-github-rulesets": findExisting([
61
+ "../forgerail-github-rulesets/.codex-plugin/plugin.json",
62
+ "plugins/forgerail-github-rulesets/.codex-plugin/plugin.json",
63
+ ]),
64
+ "forgerail-release-safety": findExisting([
65
+ "../forgerail-release-safety/.codex-plugin/plugin.json",
66
+ "plugins/forgerail-release-safety/.codex-plugin/plugin.json",
67
+ ]),
68
+ "forgerail-thread-closure": findExisting([
69
+ "../forgerail-thread-closure/.codex-plugin/plugin.json",
70
+ "plugins/forgerail-thread-closure/.codex-plugin/plugin.json",
71
+ ]),
72
+ };
73
+
74
+ for (const name of expectedPlugins) {
75
+ const plugin = json(pluginPaths[name]);
76
+ record(`${name}-identity`, plugin.name === name, plugin.name);
77
+ record(`${name}-version`, plugin.version === expectedVersion, plugin.version);
78
+ record(`${name}-license`, plugin.license === "Apache-2.0", plugin.license);
79
+ const licensePath = name === "forgerail" ? "LICENSE" : pluginPaths[name].replace(".codex-plugin/plugin.json", "LICENSE");
80
+ record(`${name}-license-file`, existsSync(resolve(root, licensePath)), licensePath);
81
+ }
82
+
83
+ const changelog = read("CHANGELOG.md");
84
+ const releaseHeading = `## ${expectedVersion} - ${expectedDate}`;
85
+ const unreleased = changelog.slice(changelog.indexOf("## Unreleased") + "## Unreleased".length, changelog.indexOf(releaseHeading)).trim();
86
+ record("changelog-version", changelog.includes(releaseHeading), releaseHeading);
87
+ record("changelog-clean-unreleased", unreleased === "No shipping changes yet.", unreleased);
88
+ for (const phrase of ["Workspace Diagnosis", "Return Receipts", "GitHub Rulesets", "Node.js 22 and 24", "Apache-2.0"]) {
89
+ record(`changelog-${phrase.toLowerCase().replaceAll(/[^a-z0-9]+/g, "-")}`, changelog.includes(phrase), phrase);
90
+ }
91
+
92
+ const marketplacePath = findExisting(["marketplace/.agents/plugins/marketplace.json", ".agents/plugins/marketplace.json"]);
93
+ const marketplace = json(marketplacePath);
94
+ const marketplacePlugins = new Map(marketplace.plugins.map((plugin) => [plugin.name, plugin]));
95
+ record("marketplace-name", marketplace.name === "echopath-labs", marketplace.name);
96
+ for (const name of expectedPlugins) {
97
+ const plugin = marketplacePlugins.get(name);
98
+ record(`marketplace-${name}`, Boolean(plugin), plugin?.source?.path ?? null);
99
+ if (name !== "forgerail") record(`marketplace-${name}-on-use`, plugin?.policy?.authentication === "ON_USE", plugin?.policy?.authentication ?? null);
100
+ }
101
+
102
+ const installation = `${read("docs/installation.md")}\n${read("docs/installation.zh-CN.md")}`;
103
+ for (const phrase of [
104
+ `codex plugin marketplace add echopath-labs/forgerail --ref ${expectedTag}`,
105
+ "codex plugin add forgerail@echopath-labs",
106
+ "codex plugin add forgerail-cross-workspace-orchestration@echopath-labs",
107
+ "codex plugin add forgerail-github-rulesets@echopath-labs",
108
+ `${expectedPackageName}@${expectedVersion}`,
109
+ "new Codex task",
110
+ "adoption-plan --workspace . --host codex",
111
+ "Host Binding Receipt",
112
+ ]) {
113
+ record(`installation-${phrase.toLowerCase().replaceAll(/[^a-z0-9]+/g, "-")}`, installation.includes(phrase), phrase);
114
+ }
115
+
116
+ for (const path of [
117
+ "contracts/adoption-plan.schema.json",
118
+ "contracts/host-adapter.schema.json",
119
+ "contracts/host-binding-receipt.schema.json",
120
+ "adapters/codex.json",
121
+ "adapters/claude-code.json",
122
+ "adapters/cursor.json",
123
+ "templates/FORGERAIL.md",
124
+ "templates/bindings/codex-compact.md",
125
+ "docs/adoption.md",
126
+ "docs/adoption.zh-CN.md",
127
+ ]) record(`adoption-path-${path.replaceAll(/[^a-z0-9]+/gi, "-").toLowerCase()}`, existsSync(resolve(root, path)), path);
128
+
129
+ const codexAdapter = json("adapters/codex.json");
130
+ const claudeAdapter = json("adapters/claude-code.json");
131
+ const cursorAdapter = json("adapters/cursor.json");
132
+ record("codex-adapter-supported", codexAdapter.status === "supported" && codexAdapter.bindingTarget === "AGENTS.md", codexAdapter.status);
133
+ record("claude-adapter-profile-only", claudeAdapter.status === "profile-only", claudeAdapter.status);
134
+ record("cursor-adapter-profile-only", cursorAdapter.status === "profile-only", cursorAdapter.status);
135
+ record("package-adapters", packageJson.files?.includes("adapters/"), packageJson.files ?? null);
136
+ record("package-templates", packageJson.files?.includes("templates/"), packageJson.files ?? null);
137
+ record("no-apply-adoption-script", !read("scripts/forgerail.mjs").includes('command === "apply-adoption"'), "no apply-adoption command");
138
+
139
+ const releaseEnglish = read("docs/release.md");
140
+ const releaseChinese = read("docs/release.zh-CN.md");
141
+ const releaseDocs = `${releaseEnglish}\n${releaseChinese}`;
142
+ for (const phrase of [
143
+ "remote_integration_approval",
144
+ "release_approval",
145
+ "lifecycle_change_approval",
146
+ expectedVersion,
147
+ expectedTag,
148
+ "Node.js 22 and 24",
149
+ "release/0.1.0-alpha.1",
150
+ "Do not unpublish",
151
+ "AGW",
152
+ "Host Binding Receipt",
153
+ ".forgerail/",
154
+ ]) {
155
+ record(`runbook-${phrase.toLowerCase().replaceAll(/[^a-z0-9]+/g, "-")}`, releaseDocs.includes(phrase), phrase);
156
+ }
157
+ for (const [id, document, phrases] of [
158
+ ["english", releaseEnglish, [
159
+ "The first public candidate must be an ordinary child of the observed public `main`.",
160
+ "an ordinary fast-forward successor of the current release head",
161
+ "the PR base and publication comparison baseline bound to the observed `main`",
162
+ "the resulting public `main` tree must equal the final signed projection tree",
163
+ "Install and discover each external Capability Pack separately",
164
+ ]],
165
+ ["chinese", releaseChinese, [
166
+ "首个公共候选必须是已观测 `main` 的普通子 commit。",
167
+ "当前 release head 的普通 fast-forward successor",
168
+ "PR base 与 publication comparison baseline 继续绑定已观测 `main`",
169
+ "公共 `main` tree 必须等于最终签名 projection tree",
170
+ "每个外部 Capability Pack 分别安装与发现",
171
+ ]],
172
+ ]) {
173
+ for (const phrase of phrases) {
174
+ record(`runbook-${id}-${phrase.toLowerCase().replaceAll(/[^a-z0-9]+/g, "-")}`, document.includes(phrase), phrase);
175
+ }
176
+ }
177
+ record("runbook-no-fixed-external-pack-count", !releaseChinese.includes("三个外部 Capability Pack"), "external Pack count is future-proof");
178
+
179
+ const workflow = read(".github/workflows/plugin-contracts.yml");
180
+ record("ci-node-22", workflow.includes("- 22"), "Node.js 22");
181
+ record("ci-node-24", workflow.includes("- 24"), "Node.js 24");
182
+ record("ci-release-source", workflow.includes("node scripts/validate-release.mjs"), "release source validator");
183
+ record("ci-progressive-adoption", workflow.includes("node scripts/forgerail.mjs validate-adoption"), "progressive adoption validator");
184
+
185
+ const failures = checks.filter((check) => !check.passed);
186
+ const report = {
187
+ schemaVersion: "1.0",
188
+ release: { version: expectedVersion, tag: expectedTag, date: expectedDate },
189
+ status: failures.length === 0 ? "passed" : "failed",
190
+ checks,
191
+ failures: failures.map(({ id, detail }) => ({ id, detail })),
192
+ };
193
+ console.log(JSON.stringify(report, null, 2));
194
+ if (failures.length > 0) process.exitCode = 1;
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: forgerail
3
+ description: Use for non-trivial AI-assisted engineering tasks or ForgeRail project adoption that need workspace ownership, rule composition, scope control, independent approval gates, validation expectations, and a verifiable handoff. ForgeRail guides the host Coding Agent without replacing its planning or execution abilities.
4
+ ---
5
+
6
+ # ForgeRail
7
+
8
+ Act as the engineering guide and guardrail for the current host Agent.
9
+
10
+ ForgeRail does not implement the task itself. Preserve the Agent's ability to analyze, plan, choose tools, and execute inside explicit boundaries.
11
+
12
+ ## Operating Loop
13
+
14
+ 1. **Observe** the smallest owner workspace, its instructions, Git state, relevant records, and user intent.
15
+ 2. **Diagnose only when needed**: first important use, explicit request, material drift, or rule conflict. Use `$forgerail-workspace-diagnosis` rather than broad scanning.
16
+ 3. **Compose** the effective Profile from authoritative sources and load only applicable Capability Packs.
17
+ 4. **Launch** work with a Task Envelope: goal, owner, allowed scope, prohibited operations, approval gates, validation, and Return Contract.
18
+ 5. **Guard** independent approval gates. Remote integration, release, production, destructive, and lifecycle authorization do not inherit from one another.
19
+ 6. **Verify** observable files, Git state, tests, logs, and external receipts against the Agent's Return Receipt.
20
+ 7. **Learn carefully**: propose reusable Profile changes with provenance. Do not persist them without user confirmation.
21
+
22
+ Always preserve unrelated user changes and dirty-worktree state. Do not treat a repository, worktree, or task branch as disposable.
23
+
24
+ ## Progressive Adoption
25
+
26
+ - Installation means capability availability, not project adoption.
27
+ - Default to Plugin Only and the minimum governance level supported by evidence.
28
+ - When durable adoption is requested, generate a read-only Adoption Plan and show its exact paths, base digests, and content before any write.
29
+ - Single-host adoption may use one versioned managed block. Multi-host adoption may use `FORGERAIL.md` as the shared Adoption Contract plus thin Host Bindings.
30
+ - Do not create `.forgerail/` state in alpha.1. Do not treat `profile-only` adapters as verified support.
31
+ - After an approved write, verify discovery in a new task or equivalent supported check and return a Host Binding Receipt.
32
+
33
+ ## Source Precedence
34
+
35
+ Apply, in order:
36
+
37
+ 1. enforced platform and hosting policy;
38
+ 2. nearest owner-workspace instructions and safety rules;
39
+ 3. explicit current-task user authorization and restrictions;
40
+ 4. confirmed workspace Profile and enabled packs;
41
+ 5. repeated observable conventions;
42
+ 6. ForgeRail portable defaults.
43
+
44
+ Surface equal-authority conflicts. Do not silently select one.
45
+
46
+ ## Pack Rules
47
+
48
+ - Installed means `available`, not `enabled` or `required`.
49
+ - Load a pack only when applicable to the task and permitted by workspace policy.
50
+ - Do not run equivalent ForgeRail and AGW checklists simultaneously; select one owner or stop on conflict.
51
+ - High-risk packs must keep their own authentication, approval, validation, and rollback boundary.
52
+
53
+ Read `references/contracts.md` when preparing a Task Envelope, Adoption Plan, Host Binding Receipt, or Return Receipt. Read `references/profile-resolution.md` when rules conflict or a durable Profile change is proposed. Read `references/adoption.md` when project adoption or cross-host portability is in scope.
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: "ForgeRail"
3
+ short_description: "Guide and guard non-trivial engineering work."
4
+ brand_color: "#B45309"
5
+ default_prompt: "Use $forgerail to guide this engineering task and verify its handoff."
6
+ policy:
7
+ allow_implicit_invocation: true
@@ -0,0 +1,13 @@
1
+ # Adoption Rules
2
+
3
+ Use the minimum level:
4
+
5
+ 1. `plugin-only`: default; no workspace mutation.
6
+ 2. `lightweight-adoption`: user-confirmed host instruction binding.
7
+ 3. `persisted-governance`: evidence-gated and deferred in alpha.1.
8
+
9
+ For one host, propose one versioned managed block in its native target. For multiple hosts, propose `FORGERAIL.md` plus thin references. Host files are adapters, not Core sources.
10
+
11
+ Run `forgerail adoption-plan --workspace <path> --host <adapter>` when the deterministic CLI is available. Never infer permission to apply the returned writes. Display exact content and paths, obtain confirmation, verify base digests immediately before writing, preserve unrelated content, and produce a Host Binding Receipt.
12
+
13
+ Codex is `supported` in alpha.1. Claude Code and Cursor are `profile-only`; do not close their binding as verified without a host-specific activation check.
@@ -0,0 +1,57 @@
1
+ # Launch And Return Contracts
2
+
3
+ ## Task Envelope
4
+
5
+ Record the current task's:
6
+
7
+ - intent and non-goals;
8
+ - owner workspace;
9
+ - allowed and prohibited operations;
10
+ - applicable packs;
11
+ - independent approval gates;
12
+ - validation requirements;
13
+ - required Return Receipt fields.
14
+
15
+ Task authorization expires with the task. Never promote it into workspace policy automatically.
16
+
17
+ ## Launch Contract
18
+
19
+ Give the host Agent the Envelope plus the effective rule sources. Specify outcomes and boundaries, not unnecessary implementation steps.
20
+
21
+ ## Return Receipt
22
+
23
+ Require:
24
+
25
+ - actual workspace, branch, and commit where applicable;
26
+ - changed scope;
27
+ - validation evidence;
28
+ - external side effects and confirmed non-mutations;
29
+ - residual risks;
30
+ - rollback or recovery entry;
31
+ - deviations from the Launch Contract.
32
+
33
+ Compare the receipt with observable state. A mismatch keeps closeout incomplete.
34
+
35
+ ## Adoption Plan
36
+
37
+ Record:
38
+
39
+ - current and proposed adoption level;
40
+ - explicitly selected Host Adapters and their support status;
41
+ - exact target paths, operations, base SHA-256 digests, candidate content, and content digests;
42
+ - required user confirmation and activation verification;
43
+ - confirmed non-mutations.
44
+
45
+ Planning is read-only. Do not expose an apply command or generate `.forgerail/` state in alpha.1.
46
+
47
+ ## Host Binding Receipt
48
+
49
+ After an explicitly approved write, record:
50
+
51
+ - the plan identity and adopted level;
52
+ - shared contract path when present;
53
+ - each host target, base and applied digests, support check, and verification status;
54
+ - changed files, discovered Skills, and activation verification mode;
55
+ - non-mutations and deviations.
56
+
57
+ A complete receipt requires every included host to be verified, activation discovery to pass, and deviations to be empty. A `profile-only` host normally keeps closeout incomplete until its host-specific check exists.
@@ -0,0 +1,14 @@
1
+ # Effective Profile Resolution
2
+
3
+ Treat the Profile as a computed model before treating it as a file.
4
+
5
+ For each effective rule, retain:
6
+
7
+ - rule identity;
8
+ - source type and locator;
9
+ - precedence class;
10
+ - observation point;
11
+ - whether it is observed, inferred, confirmed, or a default;
12
+ - owning Capability Pack when applicable.
13
+
14
+ Do not create `.forgerail/`, edit `AGENTS.md`, or initialize a record system merely to materialize the Profile. When a reusable rule deserves persistence, present a candidate, the proposed owner/source, evidence, effect, and rollback, then wait for user confirmation.
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: forgerail-workspace-diagnosis
3
+ description: Use on the first important ForgeRail task, on explicit request, or when workspace rules conflict, drift, or appear insufficient. Performs a bounded read-only diagnosis of existing instructions, records, Git and delivery habits, Skills, and recovery signals before recommending governance changes.
4
+ ---
5
+
6
+ # ForgeRail Workspace Diagnosis
7
+
8
+ Default to Analyze First and read-only operation.
9
+
10
+ ## Boundaries
11
+
12
+ - Inspect the smallest owner workspace first.
13
+ - Do not bulk-read archives, dependencies, secrets, unrelated child repositories, or broad history.
14
+ - Do not edit files, install systems, create issues, change repository settings, or persist a Profile without separate authorization.
15
+ - An unavailable integration is not evidence of empty history.
16
+
17
+ ## Diagnosis
18
+
19
+ 1. Identify workspace and nested owner boundaries.
20
+ 2. Observe the nearest Agent instructions, Git/default branch evidence, existing record systems, validation/build entries, installed Skills/Plugins, and declared delivery rules.
21
+ 3. Classify every finding as `observed_fact`, `inference`, `gap`, `recommendation`, or `requires_confirmation`.
22
+ 4. Follow existing habits when they are coherent and sufficient.
23
+ 5. Recommend a record-system change only for a concrete gap. OpenSpec may be a preferred example, but Spec Kit, Markdown/ADR, issue-based, or custom documented systems remain valid.
24
+ 6. Recommend packs as candidates; installation never implies activation.
25
+ 7. Report the observed ForgeRail adoption level and Host Adapter status. Default to Plugin Only; recommend Lightweight Adoption only for an explicit durable-adoption need or a concrete recurring gap.
26
+ 8. Never create `.forgerail/` state during diagnosis. Treat Claude Code and Cursor profiles as unverified until host-specific discovery evidence exists.
27
+
28
+ ## Output
29
+
30
+ Return:
31
+
32
+ - boundary and evidence inventory;
33
+ - existing habits and source locators;
34
+ - conflicts and gaps;
35
+ - effective defaults that can safely be inherited;
36
+ - at most a few prioritized recommendations;
37
+ - changes requiring explicit approval;
38
+ - whether a full `$workspace-health-review` is warranted.
39
+
40
+ If the user chooses adoption, hand control back to `$forgerail` for a read-only Adoption Plan, explicit confirmation, bounded write, discovery verification, and Host Binding Receipt.
41
+
42
+ Read `references/record-strategies.md` when evaluating how the workspace records durable engineering context.
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: "ForgeRail Workspace Diagnosis"
3
+ short_description: "Diagnose workspace habits before changing governance."
4
+ brand_color: "#B45309"
5
+ default_prompt: "Use $forgerail-workspace-diagnosis to inspect this workspace and recommend only evidence-backed changes."
6
+ policy:
7
+ allow_implicit_invocation: true
@@ -0,0 +1,13 @@
1
+ # Record Strategy Diagnosis
2
+
3
+ Diagnose capabilities instead of matching a closed product list.
4
+
5
+ Look for whether the current practice can:
6
+
7
+ - discover requirements, decisions, tasks, evidence, status, and recovery entries;
8
+ - route each record to a clear owner;
9
+ - distinguish active and completed work;
10
+ - link related code, docs, changes, and external work;
11
+ - support the current task's review and recovery needs.
12
+
13
+ OpenSpec, Spec Kit, Markdown, ADRs, issues, Linear, Jira, and custom systems are examples, not an allow-list. Use visible workspace instructions and user context for unknown systems. Recommend a dedicated provider pack only when deterministic schema, API, identity, or mutation semantics are necessary.
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: workspace-health-review
3
+ description: Use for periodic or requested workspace health reviews focused on durable records, agent instructions, skills, rules, ownership, stale context, context drift, context debt, and recovery risks. Use before large refactors, releases, onboarding, or cleanup. Do not use for implementation or release execution.
4
+ ---
5
+
6
+ # Workspace Health Review
7
+
8
+ Review whether the workspace remains maintainable, recoverable, and safe for Agents.
9
+
10
+ This is the first built-in ForgeRail Capability Pack and preserves the established `workspace-health-review` identity. It remains independently invokable and defaults to Analyze First.
11
+
12
+ ## Boundaries
13
+
14
+ - Do not implement features, execute releases, archive records, rewrite Skills, or change Agent instructions without approval.
15
+ - Follow the smallest owner workspace and distinguish project extensions from portable findings.
16
+ - Do not require ForgeRail Core to be invoked first.
17
+
18
+ ## Review
19
+
20
+ 1. Map workspace and child ownership boundaries.
21
+ 2. Inventory existing Agent entries, record systems, Skills, docs, rules, and recovery surfaces.
22
+ 3. Review durable-record health, instruction duplication, default context load, ownership, recovery, drift, and debt.
23
+ 4. Use categorical status: `Healthy`, `Watch`, `Risky`, or `Critical`. Use a number only with an explained method and evidence.
24
+ 5. Return path-based P0/P1/P2 findings and separate observations from proposed modifications.
25
+ 6. Recommend ForgeRail Profile or pack changes only as candidates requiring confirmation.
26
+
27
+ Read `references/health-review.md` for detailed signals.
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: "Workspace Health Review"
3
+ short_description: "Audit workspace governance, drift, debt, and recovery."
4
+ brand_color: "#B45309"
5
+ default_prompt: "Use $workspace-health-review to audit this workspace without changing it."
6
+ policy:
7
+ allow_implicit_invocation: true
@@ -0,0 +1,21 @@
1
+ # Workspace Health Signals
2
+
3
+ Review the smallest useful evidence for:
4
+
5
+ - unclear root versus child workspace ownership;
6
+ - important decisions existing only in chat;
7
+ - completed records left active without reason;
8
+ - duplicated or conflicting Agent instructions;
9
+ - too many globally or implicitly loaded Skills;
10
+ - missing owner, next entry, fallback keyword, lifecycle, or recovery path;
11
+ - stale active links pointing to moved or archived records;
12
+ - release or production rules mixed into generic workflow guidance;
13
+ - hidden durable mutation without human approval.
14
+
15
+ Prefer categorical status. Recommendations are:
16
+
17
+ - `P0`: blocks high-risk work or safe recovery;
18
+ - `P1`: should be corrected soon;
19
+ - `P2`: useful cleanup.
20
+
21
+ Every proposed modification must name its target and state that approval is required.
@@ -0,0 +1,15 @@
1
+ <!-- forgerail:adoption-contract:v1:start -->
2
+ # ForgeRail Adoption Contract
3
+
4
+ This workspace uses ForgeRail as a guide, initiator, Agent contract, and guardrail. The host Agent remains responsible for analysis, planning, tool choice, and implementation.
5
+
6
+ - Observe the smallest owner workspace and follow coherent existing record habits before recommending a new system.
7
+ - Use the minimum applicable governance level and load only Capability Packs relevant to the current task.
8
+ - Keep remote integration, release, production, destructive, and lifecycle approvals independent.
9
+ - Do not persist governance changes, enable optional packs, or mutate repository settings without exact user authorization.
10
+ - Verify observable state and return a receipt that includes validation, non-mutations, residual risks, and recovery.
11
+
12
+ Applicable hosts: {{HOSTS}}.
13
+
14
+ Host-specific files are thin discovery adapters for this contract. They are not independent governance sources.
15
+ <!-- forgerail:adoption-contract:v1:end -->
@@ -0,0 +1,5 @@
1
+ <!-- forgerail:binding:claude-code:v1:start -->
2
+ ## ForgeRail
3
+
4
+ For non-trivial AI-assisted engineering work, follow `FORGERAIL.md`. This Claude Code binding is a profile-only adapter in ForgeRail alpha.1 and requires host-specific verification before it can be treated as active.
5
+ <!-- forgerail:binding:claude-code:v1:end -->
@@ -0,0 +1,5 @@
1
+ <!-- forgerail:binding:codex:v1:start -->
2
+ ## ForgeRail
3
+
4
+ For non-trivial AI-assisted engineering work, use the installed `$forgerail` Skill as the guide and guardrail while preserving Codex's own analysis and execution ability. Use `$forgerail-workspace-diagnosis` on first important use, explicit request, material drift, or rule conflict. Follow existing coherent workspace record habits; propose changes before writing them. Keep approval gates independent and return verifiable evidence. Installation does not enable optional Capability Packs or authorize external side effects.
5
+ <!-- forgerail:binding:codex:v1:end -->
@@ -0,0 +1,5 @@
1
+ <!-- forgerail:binding:codex:v1:start -->
2
+ ## ForgeRail
3
+
4
+ For non-trivial AI-assisted engineering work, follow `FORGERAIL.md` and use the installed `$forgerail` Skill. Host-specific instructions are discovery adapters; `FORGERAIL.md` is the shared adoption contract.
5
+ <!-- forgerail:binding:codex:v1:end -->
@@ -0,0 +1,7 @@
1
+ ---
2
+ description: Apply the shared ForgeRail adoption contract to non-trivial AI-assisted engineering work
3
+ alwaysApply: true
4
+ ---
5
+ <!-- forgerail:binding:cursor:v1:start -->
6
+ Follow `FORGERAIL.md` for non-trivial AI-assisted engineering work. This Cursor binding is a profile-only adapter in ForgeRail alpha.1 and requires host-specific verification before it can be treated as active.
7
+ <!-- forgerail:binding:cursor:v1:end -->