shift-ax 0.3.0

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 (148) hide show
  1. package/LICENSE +21 -0
  2. package/README.ko.md +145 -0
  3. package/README.md +143 -0
  4. package/dist/adapters/claude-code/adapter.js +90 -0
  5. package/dist/adapters/codex/adapter.js +94 -0
  6. package/dist/adapters/contracts.js +7 -0
  7. package/dist/adapters/index.js +12 -0
  8. package/dist/core/context/context-bundle.js +300 -0
  9. package/dist/core/context/discovery.js +82 -0
  10. package/dist/core/context/global-index-authoring.js +199 -0
  11. package/dist/core/context/global-knowledge-updates.js +116 -0
  12. package/dist/core/context/glossary.js +73 -0
  13. package/dist/core/context/guided-onboarding.js +233 -0
  14. package/dist/core/context/index-authoring.js +47 -0
  15. package/dist/core/context/index-resolver.js +78 -0
  16. package/dist/core/context/onboarding.js +186 -0
  17. package/dist/core/diagnostics/doctor.js +154 -0
  18. package/dist/core/finalization/commit-message.js +76 -0
  19. package/dist/core/finalization/commit-workflow.js +131 -0
  20. package/dist/core/memory/consolidation.js +99 -0
  21. package/dist/core/memory/decision-register.js +141 -0
  22. package/dist/core/memory/entity-memory.js +25 -0
  23. package/dist/core/memory/learned-debug.js +52 -0
  24. package/dist/core/memory/summary-checkpoints.js +9 -0
  25. package/dist/core/memory/thread-promotion.js +22 -0
  26. package/dist/core/memory/threads.js +66 -0
  27. package/dist/core/memory/topic-recall.js +52 -0
  28. package/dist/core/observability/context-health.js +15 -0
  29. package/dist/core/observability/context-monitor.js +29 -0
  30. package/dist/core/observability/state-handoff.js +78 -0
  31. package/dist/core/observability/topic-status.js +40 -0
  32. package/dist/core/observability/topics-status.js +26 -0
  33. package/dist/core/observability/verification-debt.js +82 -0
  34. package/dist/core/planning/brainstorm.js +120 -0
  35. package/dist/core/planning/escalation.js +69 -0
  36. package/dist/core/planning/execution-handoff.js +61 -0
  37. package/dist/core/planning/execution-launch.js +156 -0
  38. package/dist/core/planning/execution-orchestrator.js +87 -0
  39. package/dist/core/planning/feedback-reactions.js +75 -0
  40. package/dist/core/planning/lifecycle-events.js +45 -0
  41. package/dist/core/planning/plan-review.js +76 -0
  42. package/dist/core/planning/policy-context-sync.js +154 -0
  43. package/dist/core/planning/request-pipeline.js +386 -0
  44. package/dist/core/planning/workflow-state.js +18 -0
  45. package/dist/core/policies/project-profile.js +28 -0
  46. package/dist/core/policies/team-preferences.js +17 -0
  47. package/dist/core/review/aggregate-reviews.js +129 -0
  48. package/dist/core/review/run-lanes.js +376 -0
  49. package/dist/core/settings/global-context-home.js +28 -0
  50. package/dist/core/settings/project-settings.js +37 -0
  51. package/dist/core/shell/platform-shell.js +144 -0
  52. package/dist/core/topics/bootstrap.js +119 -0
  53. package/dist/core/topics/topic-artifacts.js +36 -0
  54. package/dist/core/topics/worktree-runtime.js +141 -0
  55. package/dist/core/topics/worktree.js +8 -0
  56. package/dist/platform/claude-code/bootstrap.js +66 -0
  57. package/dist/platform/claude-code/execution.js +157 -0
  58. package/dist/platform/claude-code/scaffold/CLAUDE.template.md +40 -0
  59. package/dist/platform/claude-code/scaffold/commands/doctor.template.md +11 -0
  60. package/dist/platform/claude-code/scaffold/commands/export-context.template.md +20 -0
  61. package/dist/platform/claude-code/scaffold/commands/onboard.template.md +43 -0
  62. package/dist/platform/claude-code/scaffold/commands/onboarding.template.md +43 -0
  63. package/dist/platform/claude-code/scaffold/commands/request.template.md +19 -0
  64. package/dist/platform/claude-code/scaffold/commands/resume.template.md +12 -0
  65. package/dist/platform/claude-code/scaffold/commands/review.template.md +10 -0
  66. package/dist/platform/claude-code/scaffold/commands/status.template.md +14 -0
  67. package/dist/platform/claude-code/scaffold/commands/topics.template.md +10 -0
  68. package/dist/platform/claude-code/scaffold/hooks/shift-ax-session-start.template.md +29 -0
  69. package/dist/platform/claude-code/tmux.js +35 -0
  70. package/dist/platform/claude-code/upstream/tmux/imported/detached-session.js +40 -0
  71. package/dist/platform/claude-code/upstream/tmux/imported/session-name.js +19 -0
  72. package/dist/platform/claude-code/upstream/worktree/imported/get-worktree-root.js +39 -0
  73. package/dist/platform/claude-code/upstream/worktree/imported/managed-worktree.js +77 -0
  74. package/dist/platform/claude-code/worktree.js +79 -0
  75. package/dist/platform/codex/bootstrap.js +69 -0
  76. package/dist/platform/codex/execution.js +163 -0
  77. package/dist/platform/codex/scaffold/AGENTS.template.md +40 -0
  78. package/dist/platform/codex/scaffold/prompts/doctor.template.md +11 -0
  79. package/dist/platform/codex/scaffold/prompts/export-context.template.md +20 -0
  80. package/dist/platform/codex/scaffold/prompts/onboard.template.md +43 -0
  81. package/dist/platform/codex/scaffold/prompts/onboarding.template.md +43 -0
  82. package/dist/platform/codex/scaffold/prompts/request.template.md +19 -0
  83. package/dist/platform/codex/scaffold/prompts/resume.template.md +14 -0
  84. package/dist/platform/codex/scaffold/prompts/review.template.md +10 -0
  85. package/dist/platform/codex/scaffold/prompts/shift-ax-bootstrap.template.md +23 -0
  86. package/dist/platform/codex/scaffold/prompts/status.template.md +14 -0
  87. package/dist/platform/codex/scaffold/prompts/topics.template.md +10 -0
  88. package/dist/platform/codex/scaffold/skills/doctor/SKILL.template.md +11 -0
  89. package/dist/platform/codex/scaffold/skills/export-context/SKILL.template.md +20 -0
  90. package/dist/platform/codex/scaffold/skills/onboard/SKILL.template.md +43 -0
  91. package/dist/platform/codex/scaffold/skills/request/SKILL.template.md +19 -0
  92. package/dist/platform/codex/scaffold/skills/resume/SKILL.template.md +14 -0
  93. package/dist/platform/codex/scaffold/skills/review/SKILL.template.md +10 -0
  94. package/dist/platform/codex/scaffold/skills/status/SKILL.template.md +14 -0
  95. package/dist/platform/codex/scaffold/skills/topics/SKILL.template.md +10 -0
  96. package/dist/platform/codex/tmux.js +45 -0
  97. package/dist/platform/codex/upstream/tmux/imported/resize-hook-registration.js +37 -0
  98. package/dist/platform/codex/upstream/tmux/imported/resize-hooks.js +29 -0
  99. package/dist/platform/codex/upstream/tmux/imported/sanitize-team-name.js +18 -0
  100. package/dist/platform/codex/upstream/worktree/imported/managed-worktree.js +208 -0
  101. package/dist/platform/codex/upstream/worktree/imported/resolve-repo-root.js +14 -0
  102. package/dist/platform/codex/worktree.js +99 -0
  103. package/dist/platform/index.js +10 -0
  104. package/dist/platform/product-shell-commands.js +17 -0
  105. package/dist/platform/scaffold.js +16 -0
  106. package/dist/platform/upstream-imports.js +5 -0
  107. package/dist/scripts/ax-approve-plan.js +30 -0
  108. package/dist/scripts/ax-bootstrap-assets.js +19 -0
  109. package/dist/scripts/ax-bootstrap-topic.js +24 -0
  110. package/dist/scripts/ax-build-context-bundle.js +35 -0
  111. package/dist/scripts/ax-checkpoint-context.js +22 -0
  112. package/dist/scripts/ax-consolidate-memory.js +7 -0
  113. package/dist/scripts/ax-context-health.js +26 -0
  114. package/dist/scripts/ax-decisions.js +32 -0
  115. package/dist/scripts/ax-doctor.js +25 -0
  116. package/dist/scripts/ax-entity-memory.js +19 -0
  117. package/dist/scripts/ax-export-context.js +8 -0
  118. package/dist/scripts/ax-finalize-commit.js +23 -0
  119. package/dist/scripts/ax-init-context.js +41 -0
  120. package/dist/scripts/ax-launch-execution.js +24 -0
  121. package/dist/scripts/ax-learned-debug-save.js +30 -0
  122. package/dist/scripts/ax-learned-debug.js +12 -0
  123. package/dist/scripts/ax-monitor-context.js +28 -0
  124. package/dist/scripts/ax-onboard-context.js +112 -0
  125. package/dist/scripts/ax-pause-work.js +33 -0
  126. package/dist/scripts/ax-platform-manifest.js +19 -0
  127. package/dist/scripts/ax-promote-thread.js +20 -0
  128. package/dist/scripts/ax-react-feedback.js +28 -0
  129. package/dist/scripts/ax-recall-topics.js +20 -0
  130. package/dist/scripts/ax-recall.js +58 -0
  131. package/dist/scripts/ax-refresh-state.js +15 -0
  132. package/dist/scripts/ax-resolve-context.js +34 -0
  133. package/dist/scripts/ax-review.js +24 -0
  134. package/dist/scripts/ax-run-request.js +198 -0
  135. package/dist/scripts/ax-scaffold-build.js +19 -0
  136. package/dist/scripts/ax-shell.js +123 -0
  137. package/dist/scripts/ax-sync-policy-context.js +40 -0
  138. package/dist/scripts/ax-team-preferences.js +20 -0
  139. package/dist/scripts/ax-thread-save.js +26 -0
  140. package/dist/scripts/ax-threads.js +11 -0
  141. package/dist/scripts/ax-topic-status.js +18 -0
  142. package/dist/scripts/ax-topics-status.js +22 -0
  143. package/dist/scripts/ax-verification-debt.js +22 -0
  144. package/dist/scripts/ax-worktree-create.js +22 -0
  145. package/dist/scripts/ax-worktree-plan.js +18 -0
  146. package/dist/scripts/ax-worktree-remove.js +18 -0
  147. package/dist/scripts/ax.js +132 -0
  148. package/package.json +71 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 handsupmin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.ko.md ADDED
@@ -0,0 +1,145 @@
1
+ # Shift AX
2
+
3
+ > Codex와 Claude Code를 위한 request-to-commit 가드레일.
4
+
5
+ **English:** [README.md](./README.md)
6
+
7
+ ## 이게 뭐냐
8
+
9
+ Shift AX는 코딩 에이전트 런타임 위에 얹는 제어 레이어다.
10
+
11
+ 주요 흐름:
12
+
13
+ 1. `~/.shift-ax/`에 재사용 가능한 업무 지식 저장
14
+ 2. 계획 전에 문맥 해석
15
+ 3. 요청별 topic/worktree 생성
16
+ 4. 사람 계획 리뷰에서 중단
17
+ 5. 검증, 리뷰, 커밋까지 이어감
18
+
19
+ 즉, 프롬프트 요령이 아니라 **반복 가능한 개발 절차**를 만들기 위한 도구다.
20
+
21
+ ## 설치
22
+
23
+ ```bash
24
+ npm install -g shift-ax
25
+ ```
26
+
27
+ 또는:
28
+
29
+ ```bash
30
+ curl -fsSL https://raw.githubusercontent.com/handsupmin/shift-ax/main/scripts/install-global.sh | bash
31
+ ```
32
+
33
+ 소스 체크아웃에서 직접 쓰려면:
34
+
35
+ ```bash
36
+ npm install
37
+ npm run build
38
+ npm link
39
+ ```
40
+
41
+ ## 사용법
42
+
43
+ ### 셸 시작
44
+
45
+ ```bash
46
+ shift-ax --codex
47
+ ```
48
+
49
+ 또는
50
+
51
+ ```bash
52
+ shift-ax --claude-code
53
+ ```
54
+
55
+ 첫 실행에서는:
56
+
57
+ 1. 선호 언어
58
+ 2. full-auto 기본 사용 여부
59
+
60
+ 를 물어보고, 아래에 저장한다:
61
+
62
+ - `~/.shift-ax/settings.json`
63
+
64
+ full-auto가 켜져 있으면:
65
+
66
+ - Codex: `--yolo`
67
+ - Claude Code: `--dangerously-skip-permissions`
68
+
69
+ ### 재사용 문맥 온보딩
70
+
71
+ Shift AX는 재사용 지식을 여기에 저장한다:
72
+
73
+ - `~/.shift-ax/index.md`
74
+ - `~/.shift-ax/work-types/`
75
+ - `~/.shift-ax/procedures/`
76
+ - `~/.shift-ax/domain-language/`
77
+
78
+ 런타임 안에서:
79
+
80
+ - **Codex:** `$onboard`
81
+ - **Claude Code:** `/onboard`
82
+
83
+ ### 작업 시작
84
+
85
+ 런타임 안에서:
86
+
87
+ - **Codex:** `$request <text>`
88
+ - **Claude Code:** `/request <text>`
89
+
90
+ 다른 자주 쓰는 명령:
91
+
92
+ - Codex: `$doctor`, `$status`, `$topics`, `$resume`, `$review`, `$export-context`
93
+ - Claude Code: `/doctor`, `/status`, `/topics`, `/resume`, `/review`, `/export-context`
94
+
95
+ ### CLI로 직접 실행
96
+
97
+ 셸 없이도 가능:
98
+
99
+ ```bash
100
+ shift-ax onboard-context --discover
101
+ shift-ax run-request --request "Build safer auth refresh flow"
102
+ shift-ax approve-plan --topic .ax/topics/<topic> --reviewer "Alex" --decision approve
103
+ shift-ax run-request --topic .ax/topics/<topic> --resume
104
+ ```
105
+
106
+ ## 다른 LLM에게 넘길 프롬프트
107
+
108
+ 다른 LLM이 설치부터 사용까지 대신 하게 하려면 아래를 넘기면 된다:
109
+
110
+ ```text
111
+ You are setting up and using Shift AX in this repository.
112
+
113
+ Goal:
114
+ - install Shift AX
115
+ - start the correct runtime shell
116
+ - onboard reusable context
117
+ - start the first request safely
118
+
119
+ Rules:
120
+ - use `shift-ax`, not `ax`, in user-facing commands
121
+ - if Shift AX is not installed, run `npm install -g shift-ax`
122
+ - if working from a source checkout instead of a global install, run:
123
+ - `npm install`
124
+ - `npm run build`
125
+ - `npm link`
126
+ - prefer `shift-ax --codex` unless the user explicitly wants Claude Code
127
+ - on first run, answer the language question using the user's language preference
128
+ - on first run, answer the full-auto question cautiously
129
+ - if `~/.shift-ax/index.md` does not exist, onboard first
130
+ - in Codex use `$onboard` and `$request ...`
131
+ - in Claude Code use `/onboard` and `/request ...`
132
+ - do not start implementation before plan approval
133
+ - if shared policy/context docs must change first, update them before resume
134
+
135
+ Suggested first commands:
136
+ 1. `shift-ax --codex`
137
+ 2. run `$onboard`
138
+ 3. run `$request <the user's task>`
139
+ ```
140
+
141
+ ## 더 보기
142
+
143
+ - Architecture: [`docs/architecture/shift-ax-architecture.md`](./docs/architecture/shift-ax-architecture.md)
144
+ - LLM setup detail: [`docs/setup/llm-install-and-bootstrap.ko.md`](./docs/setup/llm-install-and-bootstrap.ko.md)
145
+ - Release notes: [`docs/release-notes/`](./docs/release-notes/)
package/README.md ADDED
@@ -0,0 +1,143 @@
1
+ # Shift AX
2
+
3
+ > Request-to-commit guardrails for Codex and Claude Code.
4
+
5
+ **한국어:** [README.ko.md](./README.ko.md)
6
+
7
+ ## What it is
8
+
9
+ Shift AX sits on top of coding-agent runtimes and makes them work in a safer delivery loop:
10
+
11
+ 1. capture reusable work knowledge in `~/.shift-ax/`
12
+ 2. resolve context before planning
13
+ 3. create a request-scoped topic/worktree
14
+ 4. pause at human plan review
15
+ 5. resume through verification, review, and commit
16
+
17
+ It is for teams that want a repeatable workflow, not prompt rituals.
18
+
19
+ ## Install
20
+
21
+ ```bash
22
+ npm install -g shift-ax
23
+ ```
24
+
25
+ Or:
26
+
27
+ ```bash
28
+ curl -fsSL https://raw.githubusercontent.com/handsupmin/shift-ax/main/scripts/install-global.sh | bash
29
+ ```
30
+
31
+ From a source checkout:
32
+
33
+ ```bash
34
+ npm install
35
+ npm run build
36
+ npm link
37
+ ```
38
+
39
+ ## How to use it
40
+
41
+ ### Start a shell
42
+
43
+ ```bash
44
+ shift-ax --codex
45
+ ```
46
+
47
+ or
48
+
49
+ ```bash
50
+ shift-ax --claude-code
51
+ ```
52
+
53
+ On first run, Shift AX asks:
54
+
55
+ 1. preferred language
56
+ 2. whether full-auto should be enabled by default
57
+
58
+ Those settings are stored in:
59
+
60
+ - `~/.shift-ax/settings.json`
61
+
62
+ If full-auto is enabled:
63
+
64
+ - Codex gets `--yolo`
65
+ - Claude Code gets `--dangerously-skip-permissions`
66
+
67
+ ### Onboard your reusable context
68
+
69
+ Shift AX keeps reusable knowledge in:
70
+
71
+ - `~/.shift-ax/index.md`
72
+ - `~/.shift-ax/work-types/`
73
+ - `~/.shift-ax/procedures/`
74
+ - `~/.shift-ax/domain-language/`
75
+
76
+ Inside the runtime:
77
+
78
+ - **Codex:** `$onboard`
79
+ - **Claude Code:** `/onboard`
80
+
81
+ ### Start work
82
+
83
+ Inside the runtime:
84
+
85
+ - **Codex:** `$request <text>`
86
+ - **Claude Code:** `/request <text>`
87
+
88
+ Other common commands:
89
+
90
+ - Codex: `$doctor`, `$status`, `$topics`, `$resume`, `$review`, `$export-context`
91
+ - Claude Code: `/doctor`, `/status`, `/topics`, `/resume`, `/review`, `/export-context`
92
+
93
+ ### CLI mode
94
+
95
+ You can also run the workflow directly:
96
+
97
+ ```bash
98
+ shift-ax onboard-context --discover
99
+ shift-ax run-request --request "Build safer auth refresh flow"
100
+ shift-ax approve-plan --topic .ax/topics/<topic> --reviewer "Alex" --decision approve
101
+ shift-ax run-request --topic .ax/topics/<topic> --resume
102
+ ```
103
+
104
+ ## Give this prompt to another LLM
105
+
106
+ If you want another LLM to install and use Shift AX for you, give it this:
107
+
108
+ ```text
109
+ You are setting up and using Shift AX in this repository.
110
+
111
+ Goal:
112
+ - install Shift AX
113
+ - start the correct runtime shell
114
+ - onboard reusable context
115
+ - start the first request safely
116
+
117
+ Rules:
118
+ - use `shift-ax`, not `ax`, in user-facing commands
119
+ - if Shift AX is not installed, run `npm install -g shift-ax`
120
+ - if working from a source checkout instead of a global install, run:
121
+ - `npm install`
122
+ - `npm run build`
123
+ - `npm link`
124
+ - prefer `shift-ax --codex` unless the user explicitly wants Claude Code
125
+ - on first run, answer the language question using the user's language preference
126
+ - on first run, answer the full-auto question cautiously
127
+ - if `~/.shift-ax/index.md` does not exist, onboard first
128
+ - in Codex use `$onboard` and `$request ...`
129
+ - in Claude Code use `/onboard` and `/request ...`
130
+ - do not start implementation before plan approval
131
+ - if shared policy/context docs must change first, update them before resume
132
+
133
+ Suggested first commands:
134
+ 1. `shift-ax --codex`
135
+ 2. run `$onboard`
136
+ 3. run `$request <the user's task>`
137
+ ```
138
+
139
+ ## More docs
140
+
141
+ - Architecture: [`docs/architecture/shift-ax-architecture.md`](./docs/architecture/shift-ax-architecture.md)
142
+ - LLM setup details: [`docs/setup/llm-install-and-bootstrap.md`](./docs/setup/llm-install-and-bootstrap.md)
143
+ - Release notes: [`docs/release-notes/`](./docs/release-notes/)
@@ -0,0 +1,90 @@
1
+ import { defaultBaseContextIndex, defaultTopicRoot } from '../contracts.js';
2
+ import { getClaudeCodeExecutionRuntime, launchClaudeCodeExecution, planClaudeCodeExecutionLaunch, } from '../../platform/claude-code/execution.js';
3
+ import { createClaudeCodeTopicWorktree, getClaudeCodeWorktreeRuntime, planClaudeCodeTopicWorktree, removeClaudeCodeTopicWorktree, } from '../../platform/claude-code/worktree.js';
4
+ import { getClaudeCodeWorktreeRoot } from '../../platform/claude-code/upstream/worktree/imported/get-worktree-root.js';
5
+ import { getClaudeCodeTmuxRuntime } from '../../platform/claude-code/tmux.js';
6
+ const CORE_COMMANDS = [
7
+ 'bootstrap-topic',
8
+ 'resolve-context',
9
+ 'review',
10
+ 'worktree-plan',
11
+ 'worktree-create',
12
+ 'worktree-remove',
13
+ 'onboard-context',
14
+ 'doctor',
15
+ 'run-request',
16
+ 'approve-plan',
17
+ 'sync-policy-context',
18
+ 'react-feedback',
19
+ 'finalize-commit',
20
+ 'launch-execution',
21
+ 'topic-status',
22
+ 'topics-status',
23
+ ];
24
+ export const claudeCodeAdapter = {
25
+ platform: 'claude-code',
26
+ getManifest(rootDir) {
27
+ const platformRoot = resolvePlatformRoot(rootDir);
28
+ const worktreeRuntime = getClaudeCodeWorktreeRuntime(platformRoot);
29
+ const tmuxRuntime = getClaudeCodeTmuxRuntime(platformRoot);
30
+ const executionRuntime = getClaudeCodeExecutionRuntime();
31
+ return {
32
+ platform: 'claude-code',
33
+ integration_mode: 'hook-bootstrap',
34
+ natural_language_first: true,
35
+ worktree_support: worktreeRuntime.support,
36
+ worktree_runtime: worktreeRuntime,
37
+ tmux_runtime: tmuxRuntime,
38
+ execution_runtime: executionRuntime,
39
+ default_base_context_index: defaultBaseContextIndex(platformRoot),
40
+ default_topic_root: defaultTopicRoot(platformRoot),
41
+ core_commands: [...CORE_COMMANDS],
42
+ };
43
+ },
44
+ renderBootstrapInstructions(rootDir) {
45
+ const platformRoot = resolvePlatformRoot(rootDir);
46
+ return [
47
+ 'Shift AX Claude Code Build',
48
+ '',
49
+ 'Bootstrap mode: hook-driven context injection.',
50
+ 'Use SessionStart and related hook surfaces to inject Shift AX startup context and guide the user into the right flow.',
51
+ `Before planning or implementation, load the base-context index at ${defaultBaseContextIndex(platformRoot)} and route the request through Shift AX core flow.`,
52
+ 'If the base-context index is missing, interview the team and persist it with `shift-ax onboard-context` (interactive) or `shift-ax onboard-context --input <file>` before starting request work.',
53
+ 'Use `shift-ax doctor` for a compact repo/runtime health report when the setup or launcher state is unclear.',
54
+ 'Use `shift-ax run-request` to bootstrap the request-scoped topic/worktree, resolve context, run the planning interview, write `execution-handoff.json`, and pause at the human planning-review gate.',
55
+ 'Use `shift-ax approve-plan` to record the human planning-review decision.',
56
+ 'If the approved plan requires shared domain or policy document updates, complete them first and record that gate with `shift-ax sync-policy-context --topic <dir> --summary "<what changed>" [--path <doc>]... [--entry "Label -> path"]...` before resuming implementation.',
57
+ 'Then resume with `shift-ax run-request --topic <dir> --resume` for automatic review and commit. Add `--no-auto-commit` only when a human explicitly wants a final manual stop.',
58
+ 'If downstream review or CI fails after the topic looked ready, use `shift-ax react-feedback --topic <dir> --kind <review-changes-requested|ci-failed> --summary "<text>"` to reopen implementation with a file-backed reaction trail.',
59
+ 'Use `shift-ax launch-execution --platform claude-code --topic <dir> [--task-id <id>] [--dry-run]` when you need the platform-owned Claude launch commands for subagent or tmux execution from `execution-handoff.json`.',
60
+ 'Use `shift-ax topic-status --topic <dir>` for a compact summary of workflow phase, review gate, execution status, and latest failure reason.',
61
+ 'Use `shift-ax topics-status [--root DIR] [--limit N]` when you need a compact list of recent topics without opening a separate dashboard.',
62
+ 'If a reviewed request hits a mandatory escalation trigger, persist that stop with `shift-ax run-request --topic <dir> --resume --escalation <kind>:<summary>` and resume only after human review with `--clear-escalations`.',
63
+ 'Use `shift-ax finalize-commit` after `shift-ax review --run` reports commit-ready status.',
64
+ 'Use `shift-ax worktree-plan` to inspect the preferred branch and worktree path for a topic.',
65
+ 'Use `shift-ax worktree-create` before implementation begins, and `shift-ax worktree-remove` when the topic worktree should be torn down.',
66
+ 'Natural language is the primary user surface. Internal AX commands exist for tooling and debugging, but the default user experience should remain conversational.',
67
+ ].join('\n');
68
+ },
69
+ commandFor(command) {
70
+ return ['shift-ax', command];
71
+ },
72
+ async planExecution(input) {
73
+ return planClaudeCodeExecutionLaunch(input);
74
+ },
75
+ async launchExecution(input) {
76
+ return launchClaudeCodeExecution(input);
77
+ },
78
+ async planWorktree(input) {
79
+ return planClaudeCodeTopicWorktree(input);
80
+ },
81
+ async createWorktree(input) {
82
+ return createClaudeCodeTopicWorktree(input);
83
+ },
84
+ async removeWorktree(input) {
85
+ return removeClaudeCodeTopicWorktree(input);
86
+ },
87
+ };
88
+ function resolvePlatformRoot(rootDir) {
89
+ return getClaudeCodeWorktreeRoot(rootDir) || rootDir;
90
+ }
@@ -0,0 +1,94 @@
1
+ import { defaultBaseContextIndex, defaultTopicRoot } from '../contracts.js';
2
+ import { getCodexExecutionRuntime, launchCodexExecution, planCodexExecutionLaunch, } from '../../platform/codex/execution.js';
3
+ import { createCodexTopicWorktree, getCodexWorktreeRuntime, planCodexTopicWorktree, removeCodexTopicWorktree, } from '../../platform/codex/worktree.js';
4
+ import { resolveCodexRepoRoot } from '../../platform/codex/upstream/worktree/imported/resolve-repo-root.js';
5
+ import { getCodexTmuxRuntime as getCodexTmuxRuntimeMetadata } from '../../platform/codex/tmux.js';
6
+ const CORE_COMMANDS = [
7
+ 'bootstrap-topic',
8
+ 'resolve-context',
9
+ 'review',
10
+ 'worktree-plan',
11
+ 'worktree-create',
12
+ 'worktree-remove',
13
+ 'onboard-context',
14
+ 'doctor',
15
+ 'run-request',
16
+ 'approve-plan',
17
+ 'sync-policy-context',
18
+ 'react-feedback',
19
+ 'finalize-commit',
20
+ 'launch-execution',
21
+ 'topic-status',
22
+ 'topics-status',
23
+ ];
24
+ export const codexAdapter = {
25
+ platform: 'codex',
26
+ getManifest(rootDir) {
27
+ const platformRoot = resolvePlatformRoot(rootDir);
28
+ const worktreeRuntime = getCodexWorktreeRuntime(platformRoot);
29
+ const tmuxRuntime = getCodexTmuxRuntimeMetadata(platformRoot);
30
+ const executionRuntime = getCodexExecutionRuntime();
31
+ return {
32
+ platform: 'codex',
33
+ integration_mode: 'agents-md-bootstrap',
34
+ natural_language_first: true,
35
+ worktree_support: worktreeRuntime.support,
36
+ worktree_runtime: worktreeRuntime,
37
+ tmux_runtime: tmuxRuntime,
38
+ execution_runtime: executionRuntime,
39
+ default_base_context_index: defaultBaseContextIndex(platformRoot),
40
+ default_topic_root: defaultTopicRoot(platformRoot),
41
+ core_commands: [...CORE_COMMANDS],
42
+ };
43
+ },
44
+ renderBootstrapInstructions(rootDir) {
45
+ const platformRoot = resolvePlatformRoot(rootDir);
46
+ return [
47
+ 'Shift AX Codex Build',
48
+ '',
49
+ 'Bootstrap mode: AGENTS.md-driven startup.',
50
+ `Before planning or implementation, load the base-context index at ${defaultBaseContextIndex(platformRoot)} and route the request through Shift AX core flow.`,
51
+ 'If the base-context index is missing, interview the team and persist it with `shift-ax onboard-context` (interactive) or `shift-ax onboard-context --input <file>` before starting request work.',
52
+ 'Use `shift-ax doctor` for a compact repo/runtime health report when the setup or launcher state is unclear.',
53
+ 'Use `shift-ax run-request` to bootstrap the request-scoped topic/worktree, resolve context, run the planning interview, write `execution-handoff.json`, and pause at the human planning-review gate.',
54
+ 'Use `shift-ax approve-plan` to record the human planning-review decision.',
55
+ 'If the approved plan requires shared domain or policy document updates, complete them first and record that gate with `shift-ax sync-policy-context --topic <dir> --summary "<what changed>" [--path <doc>]... [--entry "Label -> path"]...` before resuming implementation.',
56
+ 'Then resume with `shift-ax run-request --topic <dir> --resume` for automatic review and commit. Add `--no-auto-commit` only when a human explicitly wants a final manual stop.',
57
+ 'If downstream review or CI fails after the topic looked ready, use `shift-ax react-feedback --topic <dir> --kind <review-changes-requested|ci-failed> --summary "<text>"` to reopen implementation with a file-backed reaction trail.',
58
+ 'Use `shift-ax launch-execution --platform codex --topic <dir> [--task-id <id>] [--dry-run]` when you need the platform-owned Codex launch commands for subagent or tmux execution from `execution-handoff.json`.',
59
+ 'Use `shift-ax topic-status --topic <dir>` for a compact summary of workflow phase, review gate, execution status, and latest failure reason.',
60
+ 'Use `shift-ax topics-status [--root DIR] [--limit N]` when you need a compact list of recent topics without opening a separate dashboard.',
61
+ 'If a reviewed request hits a mandatory escalation trigger, persist that stop with `shift-ax run-request --topic <dir> --resume --escalation <kind>:<summary>` and resume only after human review with `--clear-escalations`.',
62
+ 'Use `shift-ax finalize-commit` after `shift-ax review --run` reports commit-ready status.',
63
+ 'Use `shift-ax worktree-plan` to inspect the preferred branch and worktree path for a topic.',
64
+ 'Use `shift-ax worktree-create` before implementation begins, and `shift-ax worktree-remove` when the topic worktree should be torn down.',
65
+ 'Natural language is the primary user surface. Internal AX commands exist for tooling and debugging, but the default user experience should remain conversational.',
66
+ ].join('\n');
67
+ },
68
+ commandFor(command) {
69
+ return ['shift-ax', command];
70
+ },
71
+ async planExecution(input) {
72
+ return planCodexExecutionLaunch(input);
73
+ },
74
+ async launchExecution(input) {
75
+ return launchCodexExecution(input);
76
+ },
77
+ async planWorktree(input) {
78
+ return planCodexTopicWorktree(input);
79
+ },
80
+ async createWorktree(input) {
81
+ return createCodexTopicWorktree(input);
82
+ },
83
+ async removeWorktree(input) {
84
+ return removeCodexTopicWorktree(input);
85
+ },
86
+ };
87
+ function resolvePlatformRoot(rootDir) {
88
+ try {
89
+ return resolveCodexRepoRoot(rootDir);
90
+ }
91
+ catch {
92
+ return rootDir;
93
+ }
94
+ }
@@ -0,0 +1,7 @@
1
+ import { join } from 'node:path';
2
+ export function defaultBaseContextIndex(rootDir) {
3
+ return join(rootDir, 'docs', 'base-context', 'index.md');
4
+ }
5
+ export function defaultTopicRoot(rootDir) {
6
+ return join(rootDir, '.ax', 'topics');
7
+ }
@@ -0,0 +1,12 @@
1
+ import { claudeCodeAdapter } from './claude-code/adapter.js';
2
+ import { codexAdapter } from './codex/adapter.js';
3
+ const ADAPTERS = {
4
+ codex: codexAdapter,
5
+ 'claude-code': claudeCodeAdapter,
6
+ };
7
+ export function listPlatformAdapters() {
8
+ return Object.values(ADAPTERS);
9
+ }
10
+ export function getPlatformAdapter(platform) {
11
+ return ADAPTERS[platform];
12
+ }