@flancer32/skill-adsm-ctx 0.2.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 (132) hide show
  1. package/.github/workflows/flows-app.yaml +95 -0
  2. package/AGENTS.md +112 -0
  3. package/LICENSE +201 -0
  4. package/README.md +246 -0
  5. package/bin/cli.mjs +55 -0
  6. package/ctx/AGENTS.md +44 -0
  7. package/ctx/README.md +24 -0
  8. package/ctx/adsm.json +5 -0
  9. package/ctx/agent/AGENTS.md +41 -0
  10. package/ctx/agent/flows/.img/flancer32-skill-adsm-ctx-github-flows.png +0 -0
  11. package/ctx/agent/flows/AGENTS.md +37 -0
  12. package/ctx/agent/flows/cfg/issues/labeled/accepted/profile.json +25 -0
  13. package/ctx/agent/flows/cfg/issues/labeled/accepted/prompt.md +104 -0
  14. package/ctx/agent/flows/cfg/issues/labeled/clarification-provided/profile.json +15 -0
  15. package/ctx/agent/flows/cfg/issues/labeled/clarification-provided/prompt.md +63 -0
  16. package/ctx/agent/flows/cfg/issues/opened/admission/profile.json +14 -0
  17. package/ctx/agent/flows/cfg/issues/opened/admission/prompt.md +110 -0
  18. package/ctx/agent/flows/cfg/profile.json +40 -0
  19. package/ctx/agent/flows/cfg/pull_request/closed/merged/profile.json +15 -0
  20. package/ctx/agent/flows/cfg/pull_request/closed/merged/prompt.md +41 -0
  21. package/ctx/agent/flows/cfg/pull_request/labeled/needs-fix/profile.json +25 -0
  22. package/ctx/agent/flows/cfg/pull_request/labeled/needs-fix/prompt.md +79 -0
  23. package/ctx/agent/flows/cfg/pull_request/labeled/ready-for-validation/profile.json +15 -0
  24. package/ctx/agent/flows/cfg/pull_request/labeled/ready-for-validation/prompt.md +72 -0
  25. package/ctx/agent/flows/cfg/pull_request/labeled/verified/profile.json +15 -0
  26. package/ctx/agent/flows/cfg/pull_request/labeled/verified/prompt.md +48 -0
  27. package/ctx/agent/flows/deployment.md +116 -0
  28. package/ctx/agent/flows/labels.md +108 -0
  29. package/ctx/agent/flows/overview.md +82 -0
  30. package/ctx/agent/prompt/cli/ai-intro.md +141 -0
  31. package/ctx/assets/.gitkeep +1 -0
  32. package/ctx/docs/AGENTS.md +121 -0
  33. package/ctx/docs/ai-intro.md +37 -0
  34. package/ctx/docs/architecture/AGENTS.md +98 -0
  35. package/ctx/docs/architecture/behavior.md +68 -0
  36. package/ctx/docs/architecture/checklists.md +48 -0
  37. package/ctx/docs/architecture/constraints.md +53 -0
  38. package/ctx/docs/architecture/constraints.skin.en.md +38 -0
  39. package/ctx/docs/architecture/decisions.md +118 -0
  40. package/ctx/docs/architecture/integration.md +31 -0
  41. package/ctx/docs/architecture/overview.md +76 -0
  42. package/ctx/docs/architecture/state.md +50 -0
  43. package/ctx/docs/architecture/structure.md +38 -0
  44. package/ctx/docs/architecture/supervision.md +71 -0
  45. package/ctx/docs/code/AGENTS.md +51 -0
  46. package/ctx/docs/code/overview.md +53 -0
  47. package/ctx/docs/code/testing.md +26 -0
  48. package/ctx/docs/environment/AGENTS.md +50 -0
  49. package/ctx/docs/environment/overview.md +33 -0
  50. package/ctx/docs/filesystem.md +44 -0
  51. package/ctx/docs/product/AGENTS.md +51 -0
  52. package/ctx/docs/product/domain.md +63 -0
  53. package/ctx/docs/product/domain.skin.en.md +40 -0
  54. package/ctx/docs/product/glossary.md +31 -0
  55. package/ctx/docs/product/overview.md +112 -0
  56. package/ctx/docs/product/overview.skin.en.md +38 -0
  57. package/ctx/docs/product/roles.md +17 -0
  58. package/ctx/docs/product/use-cases.md +15 -0
  59. package/jsconfig.json +12 -0
  60. package/migrations/README.md +9 -0
  61. package/package.json +33 -0
  62. package/skill/SKILL.md +47 -0
  63. package/skill/references/agents-hierarchy.md +45 -0
  64. package/skill/references/context-lifecycle.md +53 -0
  65. package/skill/references/design-questionnaire.md +44 -0
  66. package/skill/references/document-projections.md +290 -0
  67. package/skill/references/documentation-compression.md +117 -0
  68. package/skill/references/documentation-quality-audit.md +199 -0
  69. package/skill/references/orchestration-model.md +41 -0
  70. package/skill/references/specialized-skills.md +31 -0
  71. package/skill/references/upgrade-policy.md +19 -0
  72. package/skill/templates/AGENTS.md +120 -0
  73. package/skill/templates/ai/AGENTS.md +59 -0
  74. package/skill/templates/ctx/AGENTS.md +45 -0
  75. package/skill/templates/ctx/README.md +27 -0
  76. package/skill/templates/ctx/adsm.json +7 -0
  77. package/skill/templates/ctx/agent/AGENTS.md +36 -0
  78. package/skill/templates/ctx/assets/.gitkeep +1 -0
  79. package/skill/templates/ctx/docs/AGENTS.md +55 -0
  80. package/skill/templates/ctx/docs/ai-intro.md +53 -0
  81. package/skill/templates/ctx/docs/architecture/AGENTS.md +42 -0
  82. package/skill/templates/ctx/docs/architecture/behavior.md +38 -0
  83. package/skill/templates/ctx/docs/architecture/checklists.md +25 -0
  84. package/skill/templates/ctx/docs/architecture/constraints.md +36 -0
  85. package/skill/templates/ctx/docs/architecture/decisions.md +33 -0
  86. package/skill/templates/ctx/docs/architecture/integration.md +27 -0
  87. package/skill/templates/ctx/docs/architecture/overview.md +73 -0
  88. package/skill/templates/ctx/docs/architecture/state.md +52 -0
  89. package/skill/templates/ctx/docs/architecture/structure.md +32 -0
  90. package/skill/templates/ctx/docs/architecture/supervision.md +61 -0
  91. package/skill/templates/ctx/docs/code/AGENTS.md +35 -0
  92. package/skill/templates/ctx/docs/code/overview.md +21 -0
  93. package/skill/templates/ctx/docs/code/testing.md +13 -0
  94. package/skill/templates/ctx/docs/environment/AGENTS.md +34 -0
  95. package/skill/templates/ctx/docs/environment/overview.md +21 -0
  96. package/skill/templates/ctx/docs/filesystem.md +39 -0
  97. package/skill/templates/ctx/docs/product/AGENTS.md +38 -0
  98. package/skill/templates/ctx/docs/product/domain.md +77 -0
  99. package/skill/templates/ctx/docs/product/glossary.md +110 -0
  100. package/skill/templates/ctx/docs/product/overview.md +74 -0
  101. package/skill/templates/ctx/docs/product/roles.md +100 -0
  102. package/skill/templates/ctx/docs/product/use-cases.md +109 -0
  103. package/skill/templates/work/context/semantic-skin.md +27 -0
  104. package/skill/templates/work/report/documentation-compression.md +34 -0
  105. package/skill/templates/work/report/documentation-quality-audit.md +90 -0
  106. package/src/Bootstrap/Cli.mjs +62 -0
  107. package/src/Bootstrap.mjs +108 -0
  108. package/src/Design/Service.mjs +36 -0
  109. package/src/Init/Service.mjs +136 -0
  110. package/src/Shared/Constants.mjs +36 -0
  111. package/src/Shared/CopyDirectory.mjs +78 -0
  112. package/src/Shared/Metadata.mjs +30 -0
  113. package/src/Shared/Path.mjs +38 -0
  114. package/src/Skill/Installer.mjs +47 -0
  115. package/src/Upgrade/Service.mjs +44 -0
  116. package/src/Validate/Service.mjs +879 -0
  117. package/test/integration/.gitkeep +1 -0
  118. package/test/integration/cli-help.test.mjs +15 -0
  119. package/test/integration/cli-init-validate.test.mjs +223 -0
  120. package/test/integration/cli-install-skill.test.mjs +41 -0
  121. package/test/unit/Bootstrap/Cli.test.mjs +23 -0
  122. package/test/unit/Bootstrap.test.mjs +53 -0
  123. package/test/unit/Design/Service.test.mjs +11 -0
  124. package/test/unit/Init/Service.test.mjs +51 -0
  125. package/test/unit/Shared/Constants.test.mjs +21 -0
  126. package/test/unit/Shared/CopyDirectory.test.mjs +31 -0
  127. package/test/unit/Shared/Metadata.test.mjs +9 -0
  128. package/test/unit/Shared/Path.test.mjs +11 -0
  129. package/test/unit/Skill/Installer.test.mjs +20 -0
  130. package/test/unit/Upgrade/Service.test.mjs +13 -0
  131. package/test/unit/Validate/Service.test.mjs +760 -0
  132. package/types.d.ts +15 -0
package/bin/cli.mjs ADDED
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from "node:fs/promises";
4
+ import path from "node:path";
5
+ import processModule from "node:process";
6
+ import {fileURLToPath} from "node:url";
7
+
8
+ import Container from "@teqfw/di/src/Container.mjs";
9
+ import NamespaceRegistry from "@teqfw/di/src/Config/NamespaceRegistry.mjs";
10
+
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = path.dirname(__filename);
13
+ const packageRoot = path.resolve(__dirname, "..");
14
+ const projectRoot = processModule.cwd();
15
+
16
+ const container = new Container();
17
+ const namespaceRegistry = new NamespaceRegistry({fs, path, appRoot: packageRoot});
18
+ const entries = await namespaceRegistry.build();
19
+
20
+ for (const entry of entries) {
21
+ container.addNamespaceRoot(entry.prefix, entry.dirAbs, entry.ext);
22
+ }
23
+
24
+ const cliArgs = processModule.argv.slice(2);
25
+ const app = await container.get("Fl32_Skill_Adsm_Ctx_Bootstrap$");
26
+
27
+ let exitCode = 1;
28
+ let stopRequested = false;
29
+
30
+ const stopApp = async function () {
31
+ if (stopRequested) return;
32
+ stopRequested = true;
33
+ try {
34
+ await app.stop();
35
+ } catch (error) {
36
+ console.error(error);
37
+ }
38
+ };
39
+
40
+ for (const signal of ["SIGINT", "SIGTERM"]) {
41
+ processModule.once(signal, () => {
42
+ void stopApp();
43
+ });
44
+ }
45
+
46
+ try {
47
+ exitCode = await app.run({projectRoot, cliArgs});
48
+ } catch (error) {
49
+ console.error(error);
50
+ exitCode = 1;
51
+ } finally {
52
+ await stopApp();
53
+ }
54
+
55
+ processModule.exit(typeof exitCode === "number" ? exitCode : 1);
package/ctx/AGENTS.md ADDED
@@ -0,0 +1,44 @@
1
+ # Cognitive Context
2
+
3
+ - Path: `ctx/AGENTS.md`
4
+ - Template Version: `20260702`
5
+ - Changed: `20260707`
6
+
7
+ ## Purpose
8
+
9
+ This file marks `ctx/` as the project cognitive context.
10
+
11
+ Use this branch for project knowledge and keep detailed ADSM methodology outside the project-facing context.
12
+
13
+ ## Bootstrap Marker
14
+
15
+ - This context follows ADSM conventions.
16
+ - Use skill `adsm-ctx` for structure validation, upgrade logic, and methodology rules.
17
+
18
+ ## Level Map
19
+
20
+ - `agent/` — project-local agent and tool materials outside the reusable ADSM baseline.
21
+ - `assets/` — visual, generated, rendered, or auxiliary artifacts that support documentation without defining authoritative meaning.
22
+ - `docs/` — project-facing documentation and constraints.
23
+ - `AGENTS.md` — level definition for `ctx/`.
24
+ - `README.md` — short entry note for the cognitive context.
25
+ - `adsm.json` — context metadata for versioning and upgrade eligibility.
26
+
27
+ ## Level Boundary
28
+
29
+ Defines:
30
+
31
+ - `ctx/` as the project cognitive context boundary.
32
+ - The split between project-facing documentation and project-local agent materials.
33
+ - The local entry points agents should read before deeper work.
34
+
35
+ Does NOT define:
36
+
37
+ - Product-specific meaning that belongs in subordinate product and architecture documents.
38
+ - Implementation structure outside the cognitive context.
39
+ - Detailed ADSM methodology that belongs to the skill and its references.
40
+
41
+ ## Local Reading Map
42
+
43
+ - Read `README.md` for a short entry note.
44
+ - Read `docs/filesystem.md` for the top-level repository map.
package/ctx/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # Cognitive Context
2
+
3
+ - Path: `ctx/README.md`
4
+ - Template Version: `20260623`
5
+ - Changed: `20260702`
6
+
7
+ ## Purpose
8
+
9
+ This directory contains the project cognitive context.
10
+
11
+ The cognitive context is the authoritative project knowledge space used by humans and agents when maintaining the project.
12
+
13
+ ## Entry Points
14
+
15
+ - Read `AGENTS.md` for cognitive-context structure and governance rules.
16
+ - Read `docs/filesystem.md` for the top-level repository map.
17
+ - Read `docs/` for declarative project documentation.
18
+ - Read `agent/` only when working with repository-local agent operations or workflow assets.
19
+
20
+ ## Boundary
21
+
22
+ This directory defines project knowledge and agent-operational context.
23
+
24
+ It does not replace product source code, runtime configuration, deployment secrets, or generated build artifacts.
package/ctx/adsm.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "schema": "adsm-context",
3
+ "version": "0.1.0",
4
+ "initializedAt": "2026-06-04"
5
+ }
@@ -0,0 +1,41 @@
1
+ # Agent External Context
2
+
3
+ - Path: `ctx/agent/AGENTS.md`
4
+ - Changed: `20260707`
5
+
6
+ ## Purpose
7
+
8
+ Defines the boundary of `ctx/agent/` for this repository.
9
+
10
+ This branch is reserved for materials that document relationships, routines, and tool-facing instructions that sit outside ADSM methodology.
11
+
12
+ Only this file belongs to the ADSM template baseline for `ctx/agent/`.
13
+
14
+ Humans and agents may create project-local subdirectories here when they need instructions or records tied to a concrete tool or relationship, such as `github-flows`.
15
+
16
+ ## Level Map
17
+
18
+ - `flows/` — operational workflow documentation and configuration for repository automation driven by labels and GitHub events.
19
+ - `prompt/` — prompt definitions used by agents when generating or maintaining repository-facing context artifacts.
20
+ - `report/` — task-specific agent reports produced during repository-local analysis or maintenance work.
21
+ - `AGENTS.md` — level definition for `ctx/agent/`.
22
+
23
+ ## Level Boundary
24
+
25
+ Defines:
26
+
27
+ - The reserved role of `ctx/agent/` as a repository-local branch outside ADSM methodology.
28
+ - The boundary between ADSM-governed context and project-local agent or tool materials.
29
+ - The rule that only `ctx/agent/AGENTS.md` is part of the template-managed baseline for this branch.
30
+
31
+ Does NOT define:
32
+
33
+ - Product meaning, domain scope, or user-facing requirements.
34
+ - Architecture ownership, system structure, or product-level engineering constraints.
35
+ - The required shape of project-local subdirectories created for concrete tools or relationships.
36
+
37
+ ## Operational Constraints
38
+
39
+ - Materials placed under project-local subdirectories in `ctx/agent/` remain outside ADSM methodology unless a higher-level context document explicitly says otherwise.
40
+ - Tool-specific instructions under this branch must stay consistent with authoritative constraints in `ctx/docs/`.
41
+ - Changes that alter agent authority or escalation expectations must remain consistent with `ctx/docs/architecture/supervision.md`.
@@ -0,0 +1,37 @@
1
+ # Agent Workflow Context
2
+
3
+ - Path: `ctx/agent/flows/AGENTS.md`
4
+ - Changed: `20260610`
5
+
6
+ ## Purpose
7
+
8
+ Defines the structure of workflow-specific operational context for repository automation.
9
+
10
+ ## Level Map
11
+
12
+ - `.img/` — supporting workflow diagrams and other visual assets referenced by the workflow documentation.
13
+ - `cfg/` — executable workflow profile fragments and shared configuration consumed by `github-flows`.
14
+ - `AGENTS.md` — level definition for `ctx/agent/flows/`.
15
+ - `deployment.md` — deployment notes for publishing and activating the workflow configuration.
16
+ - `labels.md` — label taxonomy and label semantics used by the workflow.
17
+ - `overview.md` — workflow model, trigger assumptions, processing rules, and end-state definitions.
18
+
19
+ ## Level Boundary
20
+
21
+ Defines:
22
+
23
+ - Workflow-specific operational semantics and end-state rules.
24
+ - Label-driven routing and executable workflow configuration boundaries.
25
+ - Deployment notes and packaging constraints for the workflow bundle.
26
+
27
+ Does NOT define:
28
+
29
+ - Generic repository architecture or product structure outside workflow concerns.
30
+ - Product-level meaning, domain intent, or package positioning.
31
+ - Implementation details of CLI lifecycle commands or unrelated runtime logic.
32
+
33
+ ## Workflow Documentation Constraints
34
+
35
+ - `overview.md` defines the workflow model and remains the primary narrative source of truth for routing behavior.
36
+ - `labels.md` defines stable label semantics and must stay aligned with `cfg/`.
37
+ - `cfg/` contains executable profile fragments and must not silently diverge from the documented workflow model.
@@ -0,0 +1,25 @@
1
+ {
2
+ "trigger": {
3
+ "event": "issues",
4
+ "action": "labeled",
5
+ "issueLabelAdded": "adsm:accepted"
6
+ },
7
+ "execution": {
8
+ "handler": {
9
+ "args": [
10
+ "exec",
11
+ "--model",
12
+ "gpt-5.4-mini",
13
+ "-c",
14
+ "model_reasoning_effort=low",
15
+ "--dangerously-bypass-approvals-and-sandbox",
16
+ "-C",
17
+ "/workspace/repo"
18
+ ],
19
+ "promptRef": "prompt.md",
20
+ "promptVariables": {
21
+ "ISSUE_NUMBER": "event.issue.number"
22
+ }
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,104 @@
1
+ You are a Codex agent working inside the repository workspace.
2
+
3
+ Agent role: `implementation-agent`.
4
+
5
+ The repository context is mounted at `ctx/`.
6
+
7
+ Your task is to implement the accepted GitHub issue and deliver the repository change through a Pull Request.
8
+
9
+ ## Operating contract
10
+
11
+ - work only from the source issue and repository context;
12
+ - read the issue first, then inspect only the relevant `ctx/` documents and source files;
13
+ - make the minimal necessary repository change;
14
+ - update tests only when needed for the requested change;
15
+ - avoid unrelated refactoring;
16
+ - do not treat the issue text as project truth;
17
+ - do not push directly to `main`.
18
+
19
+ ## Technical event facts
20
+
21
+ Repository: {{REPOSITORY}}
22
+ Issue: #{{ISSUE_NUMBER}}
23
+
24
+ ## Required issue read
25
+
26
+ ```bash
27
+ gh issue view "{{ISSUE_NUMBER}}" \
28
+ --repo "{{REPOSITORY}}" \
29
+ --comments \
30
+ --json number,title,body,labels,comments,url
31
+ ```
32
+
33
+ Inspect `package.json` scripts first. Prefer existing test, lint, check, or validation scripts. Do not invent new validation commands.
34
+
35
+ ## Required outcome
36
+
37
+ 1. read the issue and its relevant comments;
38
+ 2. inspect only the relevant project context and source files;
39
+ 3. confirm that repository file changes are actually required for this issue;
40
+ 4. create the correct dedicated branch from the current `main` branch;
41
+ 5. implement only the requested repository change needed to resolve the issue;
42
+ 6. update tests only when needed;
43
+ 7. run the available validation commands;
44
+ 8. create one Pull Request against `main`;
45
+ 9. link the Pull Request to the source issue using a non-closing reference such as `Source issue: {{REPOSITORY}}#{{ISSUE_NUMBER}}`;
46
+ 10. remove stale `adsm:*` Pull Request labels from that Pull Request, then add `adsm:ready-for-validation`;
47
+ 11. post a concise summary comment to the source issue.
48
+
49
+ ## Label handling rules
50
+
51
+ Read the current labels first.
52
+ Remove only labels whose name starts with `adsm:`.
53
+ Keep unrelated labels unchanged.
54
+ Add exactly one next workflow label.
55
+
56
+ Removable ADSM labels on the current issue or Pull Request:
57
+
58
+ - `adsm:accepted`
59
+ - `adsm:answered`
60
+ - `adsm:rejected`
61
+ - `adsm:needs-clarification`
62
+ - `adsm:clarification-provided`
63
+ - `adsm:ready-for-validation`
64
+ - `adsm:verified`
65
+ - `adsm:needs-fix`
66
+
67
+ Remove only the listed ADSM labels that are actually present on the current issue or Pull Request. Keep all unrelated labels unchanged.
68
+
69
+ For the created or updated Pull Request, the next workflow label must be exactly `adsm:ready-for-validation`.
70
+
71
+ If you need to change issue labels during failure handling, remove stale issue `adsm:*` labels first and keep unrelated issue labels unchanged. Do not remove labels from unrelated issues or Pull Requests.
72
+
73
+ After creating the Pull Request, read or capture the created Pull Request number and use that number for Pull Request label operations.
74
+
75
+ Simple command pattern:
76
+
77
+ ```bash
78
+ gh pr edit "<created-pr-number>" --repo "{{REPOSITORY}}" --remove-label "adsm:needs-fix"
79
+ gh pr edit "<created-pr-number>" --repo "{{REPOSITORY}}" --add-label "adsm:ready-for-validation"
80
+ ```
81
+
82
+ Use a branch name in the form:
83
+
84
+ ```text
85
+ adsm/issue-{{ISSUE_NUMBER}}-<short-slug>
86
+ ```
87
+
88
+ ## Failure handling
89
+
90
+ - if no repository changes are required, do not create a branch or Pull Request, post a comment on the source issue explaining that no repository changes are needed, remove stale `adsm:*` issue labels from the current issue, then add `adsm:answered` and stop;
91
+ - if required project context is still not sufficient to proceed safely, explain the missing context in an issue comment, remove stale `adsm:*` issue labels from the current issue, then add `adsm:needs-clarification`;
92
+ - if the issue still needs clarification, explain it in an issue comment, remove stale `adsm:*` issue labels from the current issue, then add `adsm:needs-clarification`;
93
+ - if the work hits a concrete internal blocker that cannot be resolved in this stage, explain it in an issue comment, remove stale `adsm:*` issue labels from the current issue, then add `adsm:needs-clarification` with one specific follow-up question for a trusted human.
94
+
95
+ ## Pull Request rules
96
+
97
+ - create or update only one dedicated branch for this issue;
98
+ - create exactly one active Pull Request for that branch;
99
+ - before creating a branch or Pull Request, confirm that repository file changes are required;
100
+ - before applying the next workflow label, remove all existing stale `adsm:*` labels from the current issue or Pull Request you are updating. Keep unrelated labels unchanged;
101
+ - add `adsm:ready-for-validation` only after commits are pushed and the Pull Request is ready;
102
+ - after creating the Pull Request, ensure that the Pull Request has exactly one workflow label: `adsm:ready-for-validation`;
103
+ - do not merge the Pull Request in this stage.
104
+ - if no validation command exists, say that clearly in the summary instead of claiming validation ran.
@@ -0,0 +1,15 @@
1
+ {
2
+ "trigger": {
3
+ "event": "issues",
4
+ "action": "labeled",
5
+ "issueLabelAdded": "adsm:clarification-provided"
6
+ },
7
+ "execution": {
8
+ "handler": {
9
+ "promptRef": "prompt.md",
10
+ "promptVariables": {
11
+ "ISSUE_NUMBER": "event.issue.number"
12
+ }
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,63 @@
1
+ You are a Codex agent working inside the repository workspace.
2
+
3
+ Agent role: `clarification-agent`.
4
+
5
+ The repository context is mounted at `ctx/`.
6
+
7
+ Your task is to resume issue processing after a trusted user provided clarification.
8
+
9
+ Make an evidence-based decision from the issue body, the latest clarification comments, and the relevant `ctx/` context.
10
+
11
+ ## Technical event facts
12
+
13
+ Repository: {{REPOSITORY}}
14
+ Issue: #{{ISSUE_NUMBER}}
15
+
16
+ ## Required issue read
17
+
18
+ ```bash
19
+ gh issue view "{{ISSUE_NUMBER}}" \
20
+ --repo "{{REPOSITORY}}" \
21
+ --comments \
22
+ --json number,title,body,labels,comments,url
23
+ ```
24
+
25
+ Focus on the latest clarification comments and the previous blocking question.
26
+
27
+ ## Decision rules
28
+
29
+ - if the issue is now clear enough and requires repository changes, replace `adsm:clarification-provided` with `adsm:accepted`;
30
+ - if the issue is now clear enough and can be fully completed by an issue comment without repository changes, post that answer and replace `adsm:clarification-provided` with `adsm:answered`;
31
+ - if the clarification shows that the issue is outside repository scope or must not be executed, post the rejection reason and replace `adsm:clarification-provided` with `adsm:rejected`;
32
+ - if the issue is still unclear, replace `adsm:clarification-provided` with `adsm:needs-clarification`;
33
+ - if the workflow is still inconsistent or another concrete internal blocker remains, replace `adsm:clarification-provided` with `adsm:needs-clarification` and ask one specific follow-up question for a trusted human.
34
+
35
+ Use the same private-workflow assumptions as admission:
36
+
37
+ - trusted users only;
38
+ - no hostile-user screening is required;
39
+ - if the issue belongs to this repository and is now clear enough, prefer `adsm:answered` when no repository changes are required and `adsm:accepted` only when repository changes are required.
40
+
41
+ Post one concise issue comment before changing the label.
42
+
43
+ Use this comment structure:
44
+
45
+ ```markdown
46
+ ### Clarification review
47
+
48
+ State: `adsm:accepted` | `adsm:answered` | `adsm:rejected` | `adsm:needs-clarification`
49
+
50
+ Reason:
51
+
52
+ <one short paragraph>
53
+ ```
54
+
55
+ If the new state is `adsm:needs-clarification`, include one specific follow-up question.
56
+ If the new state is `adsm:answered`, make the comment itself contain the final answer and say that no repository changes are required.
57
+ If the new state is `adsm:rejected`, make the comment itself contain the rejection reason, replace the current workflow label with `adsm:rejected`, and close the issue.
58
+
59
+ If the new state is `adsm:answered`, replace the current workflow label with `adsm:answered`, close the issue, and do not create a Pull Request.
60
+
61
+ Before applying the next workflow label, remove all existing stale current workflow `adsm:*` labels from the current issue. Keep unrelated labels unchanged.
62
+
63
+ Do not add `adsm:accepted` as a second workflow label. Replace the current label.
@@ -0,0 +1,14 @@
1
+ {
2
+ "trigger": {
3
+ "event": "issues",
4
+ "action": "opened"
5
+ },
6
+ "execution": {
7
+ "handler": {
8
+ "promptRef": "prompt.md",
9
+ "promptVariables": {
10
+ "ISSUE_NUMBER": "event.issue.number"
11
+ }
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,110 @@
1
+ You are a Codex agent working inside the repository workspace.
2
+
3
+ Agent role: `admission-agent`.
4
+
5
+ The repository context is mounted at `ctx/`.
6
+
7
+ Your task is to perform admission for the newly opened GitHub issue.
8
+
9
+ Admission is a minimal repository-fit and clarity check, not implementation.
10
+
11
+ ## Operating contract
12
+
13
+ - handle only this issue admission step;
14
+ - treat the issue as input, not as project truth;
15
+ - use `ctx/` as the source of truth for project scope and constraints;
16
+ - do not modify repository files, branches, Pull Requests, or `ctx/`.
17
+
18
+ ## Technical event facts
19
+
20
+ Repository: {{REPOSITORY}}
21
+ Issue: #{{ISSUE_NUMBER}}
22
+
23
+ ## Required issue read
24
+
25
+ Read the full issue through GitHub CLI:
26
+
27
+ ```bash
28
+ gh issue view "{{ISSUE_NUMBER}}" \
29
+ --repo "{{REPOSITORY}}" \
30
+ --comments \
31
+ --json number,title,body,labels,comments,url,author
32
+ ```
33
+
34
+ Read the relevant project context in `ctx/` before deciding.
35
+
36
+ ## Decision criteria
37
+
38
+ Check whether the issue:
39
+
40
+ 1. belongs to this repository and product;
41
+ 2. is clear enough to start work without guessing;
42
+ 3. can be implemented from the current repository context as it exists now;
43
+ 4. should be accepted for repository changes, answered by comment only, rejected, or sent for clarification based on the evidence.
44
+
45
+ Use the private workflow assumptions of this repository:
46
+
47
+ - trusted users only;
48
+ - no hostile-user screening is required;
49
+ - no generic restriction on communicating with external systems is part of admission;
50
+ - if the issue belongs to this repository, use `adsm:answered` when a comment fully resolves it without repository changes;
51
+ - use `adsm:accepted` only when repository changes are required.
52
+
53
+ ## Allowed output states
54
+
55
+ Apply exactly one next state label:
56
+
57
+ - `adsm:accepted`
58
+ - `adsm:answered`
59
+ - `adsm:rejected`
60
+ - `adsm:needs-clarification`
61
+
62
+ ## Evidence and label rules
63
+
64
+ - inspect current labels before writing;
65
+ - keep only one current `adsm:*` label on the issue;
66
+ - if a correct admission comment and label already exist, do not duplicate them;
67
+ - base the decision on issue content, existing comments, and project context evidence from `ctx/`, not on assumptions.
68
+ - do not use `adsm:accepted` for analysis-only, explanation-only, review-only, or comment-only requests;
69
+ - if the issue can be completed by posting a comment without changing repository files, post the answer, apply `adsm:answered`, and do not create a branch or Pull Request;
70
+ - use `adsm:rejected` when the issue is outside repository scope or must not be executed;
71
+ - use `adsm:needs-clarification` when trusted human input is required before a safe decision;
72
+ - after applying the next workflow label, confirm that the current issue has exactly one current `adsm:*` workflow label.
73
+
74
+ Use these state meanings narrowly:
75
+
76
+ - `adsm:accepted` when the issue belongs here, is actionable enough to start, and requires repository changes;
77
+ - `adsm:answered` when the issue belongs here and can be fully completed by an issue comment without repository changes;
78
+ - `adsm:rejected` when the issue does not belong to this repository;
79
+ - `adsm:needs-clarification` when one concrete missing detail, workflow inconsistency, or internal blocker requires trusted human input before starting.
80
+
81
+ Before applying the label, post one issue comment with this structure:
82
+
83
+ ```markdown
84
+ ### Admission decision
85
+
86
+ State: `adsm:accepted` | `adsm:answered` | `adsm:rejected` | `adsm:needs-clarification`
87
+
88
+ Reason:
89
+
90
+ <one short paragraph>
91
+
92
+ Next step:
93
+
94
+ <one short sentence>
95
+ ```
96
+
97
+ If the state is `adsm:needs-clarification`, `Next step` must be one specific question.
98
+ If the state is `adsm:answered`, `Next step` should say that no repository changes are required.
99
+
100
+ Post the comment first. Apply the selected label second.
101
+
102
+ If the state is `adsm:answered`, remove stale current workflow labels from the issue, apply `adsm:answered`, close the issue, and do not create a branch or Pull Request.
103
+ If the state is `adsm:rejected`, post the rejection reason first, remove stale current workflow labels from the issue, apply `adsm:rejected`, close the issue, and do not create a branch or Pull Request.
104
+ If the state is `adsm:accepted`, post the admission comment first, remove stale current workflow labels from the issue, apply `adsm:accepted`, and do not close the issue.
105
+
106
+ Before applying the next workflow label, remove all existing stale current workflow `adsm:*` labels from the current issue. Keep unrelated labels unchanged.
107
+
108
+ Use `gh issue comment` and `gh issue edit`.
109
+
110
+ Do not create, rename, or delete labels.
@@ -0,0 +1,40 @@
1
+ {
2
+ "trigger": {
3
+ "repository": "flancer32/skill-adsm-ctx",
4
+ "actorLogin": ["flancer64", "viktor-gusev", "adsm-agentess"]
5
+ },
6
+ "execution": {
7
+ "handler": {
8
+ "type": "agent",
9
+ "command": ["codex"],
10
+ "args": [
11
+ "exec",
12
+ "--model",
13
+ "gpt-5.4",
14
+ "-c",
15
+ "model_reasoning_effort=medium",
16
+ "--dangerously-bypass-approvals-and-sandbox",
17
+ "-C",
18
+ "/workspace/repo"
19
+ ],
20
+ "promptVariables": {
21
+ "REPOSITORY": "event.repository.full_name"
22
+ }
23
+ },
24
+ "runtime": {
25
+ "image": "github-flows-agent-codex:latest",
26
+ "setupScript": "set -eu; export GH_TOKEN=\"$(tr -d '\\r\\n' < \"$GH_TOKEN_FILE\")\"; test -f /workspace/repo/ctx/AGENTS.md && test -d /workspace/repo/ctx/docs",
27
+ "timeoutSec": 1800,
28
+ "env": {
29
+ "LOG_LEVEL": "info",
30
+ "GH_TOKEN_FILE": "/run/secrets/gh-token"
31
+ },
32
+ "dockerArgs": [
33
+ "--mount",
34
+ "type=bind,src=/home/agentess/.secrets/codex,dst=/home/agentess/.codex",
35
+ "--mount",
36
+ "type=bind,src=/home/agentess/.secrets/gh-token,dst=/run/secrets/gh-token,readonly"
37
+ ]
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "trigger": {
3
+ "event": "pull_request",
4
+ "action": "closed",
5
+ "pullRequestMerged": true
6
+ },
7
+ "execution": {
8
+ "handler": {
9
+ "promptRef": "prompt.md",
10
+ "promptVariables": {
11
+ "PR_NUMBER": "event.pull_request.number"
12
+ }
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,41 @@
1
+ You are a Codex agent working inside the repository workspace.
2
+
3
+ Agent role: `finalization-agent`.
4
+
5
+ The repository context is mounted at `ctx/`.
6
+
7
+ Your task is to finalize a merged workflow Pull Request.
8
+
9
+ Make an evidence-based finalization decision from the merged Pull Request, its validation comments, and the linked source issue reference.
10
+
11
+ ## Technical event facts
12
+
13
+ Repository: {{REPOSITORY}}
14
+ Pull Request: #{{PR_NUMBER}}
15
+
16
+ ## Required Pull Request read
17
+
18
+ ```bash
19
+ gh pr view "{{PR_NUMBER}}" \
20
+ --repo "{{REPOSITORY}}" \
21
+ --comments \
22
+ --json number,title,body,labels,comments,mergedAt,url
23
+ ```
24
+
25
+ Identify the linked source issue from the Pull Request body first. Use comments only as a fallback.
26
+
27
+ ## Required outcome
28
+
29
+ 1. confirm that the Pull Request was merged;
30
+ 2. identify the linked source issue;
31
+ 3. post a final issue comment containing:
32
+ - the Pull Request link;
33
+ - a short summary of changes;
34
+ - the validation state;
35
+ 4. remove stale current workflow labels from the linked source issue, apply `adsm:completed`, and close the linked source issue.
36
+
37
+ Before closing the linked source issue, remove all stale current workflow `adsm:*` labels from that issue. Keep unrelated labels unchanged.
38
+
39
+ Remove labels only from the linked source issue. Do not remove labels from unrelated issues or Pull Requests.
40
+
41
+ If the linked source issue cannot be identified safely, do not guess. Post a Pull Request comment and stop with manual follow-up.
@@ -0,0 +1,25 @@
1
+ {
2
+ "trigger": {
3
+ "event": "pull_request",
4
+ "action": "labeled",
5
+ "pullRequestLabelAdded": "adsm:needs-fix"
6
+ },
7
+ "execution": {
8
+ "handler": {
9
+ "args": [
10
+ "exec",
11
+ "--model",
12
+ "gpt-5.4-mini",
13
+ "-c",
14
+ "model_reasoning_effort=low",
15
+ "--dangerously-bypass-approvals-and-sandbox",
16
+ "-C",
17
+ "/workspace/repo"
18
+ ],
19
+ "promptRef": "prompt.md",
20
+ "promptVariables": {
21
+ "PR_NUMBER": "event.pull_request.number"
22
+ }
23
+ }
24
+ }
25
+ }