Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
203 commits
Select commit Hold shift + click to select a range
c2535c3
Add system documentation
May 5, 2026
3167900
Add skill reference docs
May 5, 2026
5bd35d6
Add installation and operation manuals
May 5, 2026
60eae34
Add schema workspace guardrails and cache ignores
May 5, 2026
aba9732
Add superpowers planning and design docs
May 5, 2026
01a8476
Add workflow ERP SQL generator skill references
May 5, 2026
d432e41
Add SQL Server test database setup assets
May 5, 2026
d90f493
Add skill_scripts package bootstrap for tests
May 5, 2026
ae05ade
Add schema metadata loaders and relationship artifacts
May 5, 2026
7788f67
Add deterministic SQL generation core and safety guard
May 5, 2026
f17a853
Add LLM routing, validation, and CLI orchestration
May 5, 2026
5191ee3
Add agent workflow documentation
May 6, 2026
f11e790
Update repository agent instructions
May 6, 2026
a83d0e1
Add governed query evidence path
May 7, 2026
aaaa1ea
Reject SQL Server 2000 CONCAT usage
May 7, 2026
014a3d9
Merge pull request #8 from paulpai0412/agent/issue-2-governed-query-e…
paulpai0412 May 7, 2026
d6590d1
Update autonomous workflow remote approval policy
May 7, 2026
f0cf084
Add workflow planning docs
May 7, 2026
f86071b
Improve static docs accessibility
May 7, 2026
a4a1b8f
Ignore local QA scratch files
May 7, 2026
e3c006a
Merge pull request #9 from paulpai0412/agent/workflow-auto-remote-act…
paulpai0412 May 7, 2026
cf46d50
Add isolated worker workflow contracts (#10)
paulpai0412 May 7, 2026
32443ef
Add chart spec authoring surface
sisyphus-dev-ai May 7, 2026
104a171
Add issue 3 chart spec handoff
sisyphus-dev-ai May 7, 2026
ba234d7
Merge pull request #11 from paulpai0412/agent/issue-3-chart-spec-auth…
paulpai0412 May 7, 2026
3766d75
Add dashboard canvas layout model
paulpai0412 May 7, 2026
d5e17d1
Add issue 7 dashboard canvas handoff
paulpai0412 May 7, 2026
b242ed4
Add compact verifier evidence contract
paulpai0412 May 7, 2026
92f7e8a
Convert issue 3 handoff to compact evidence
paulpai0412 May 7, 2026
846be3f
Convert issue 7 handoff to compact evidence
paulpai0412 May 7, 2026
bf00d50
Merge pull request #12 from paulpai0412/agent/issue-7-dashboard-canva…
paulpai0412 May 7, 2026
0eaaec7
Add design template catalog
paulpai0412 May 7, 2026
9dd8304
Add issue 4 design template handoff
paulpai0412 May 7, 2026
7e4c527
Update issue 4 handoff for PR 13
paulpai0412 May 7, 2026
828e87a
Update issue 4 evidence commit reference
paulpai0412 May 7, 2026
6abab4d
Enforce autonomous workflow role separation
paulpai0412 May 7, 2026
1863096
Merge pull request #14 from paulpai0412/agent/workflow-role-separatio…
paulpai0412 May 7, 2026
422aa74
Record issue 4 verifier evidence
paulpai0412 May 7, 2026
487bc1c
Merge pull request #13 from paulpai0412/agent/issue-4-design-template…
paulpai0412 May 7, 2026
b914467
Add issue 5 implementation packet
paulpai0412 May 7, 2026
e466e37
Add dashboard publish workflow
paulpai0412 May 7, 2026
6485d51
Record issue 5 verifier evidence
paulpai0412 May 7, 2026
8cc5e70
Merge pull request #15 from paulpai0412/agent/issue-5-final-dashboard…
paulpai0412 May 7, 2026
0050939
Add autonomous release policy gates
paulpai0412 May 7, 2026
d462048
Add compact context artifact templates
paulpai0412 May 7, 2026
cb1cc7f
Add context budget script gate
paulpai0412 May 7, 2026
3994a46
Record issue 16 worker handoff
paulpai0412 May 7, 2026
7fa9d93
Add verifier evidence packet for issue #16 PR #17
paulpai0412 May 7, 2026
262ed48
Merge PR #17: Add context budget and release worker gates
paulpai0412 May 7, 2026
35022e8
Add published dashboard link runtime
paulpai0412 May 7, 2026
ed1a59c
Update issue 6 evidence commit reference
paulpai0412 May 7, 2026
a5cf2ab
Repair published dashboard link failure handling
paulpai0412 May 7, 2026
c3e150a
Update issue 6 worker repair artifacts
paulpai0412 May 7, 2026
8d753fa
Record issue 6 worker publication
paulpai0412 May 7, 2026
603835e
Publish issue 6 verifier evidence
paulpai0412 May 7, 2026
de39376
Merge pull request #18 from paulpai0412/agent/issue-6-published-dashb…
paulpai0412 May 7, 2026
ecbfce3
Add PRD phase completeness audit flow
paulpai0412 May 7, 2026
997459d
Add Phase 1 OpenCode command
paulpai0412 May 7, 2026
b256472
Add Phase 1 compact payload helper
paulpai0412 May 7, 2026
49f6947
Add Phase 1 orchestrator runner
paulpai0412 May 7, 2026
fd85c78
Merge pull request #19 from paulpai0412/agent/issue-6-published-dashb…
paulpai0412 May 7, 2026
b5a6326
Reconstruct issue 2 traceability artifacts
paulpai0412 May 7, 2026
fe2f6d7
Prepare issue 20 workflow repair packet
paulpai0412 May 7, 2026
155bb67
Update traceability checkpoint gate
paulpai0412 May 7, 2026
92e8b17
Record issue 20 PR references
paulpai0412 May 7, 2026
9338de0
Add issue 20 verifier artifacts
paulpai0412 May 7, 2026
e40f380
Resolve issue 20 merge conflicts
paulpai0412 May 7, 2026
acb13e1
Merge pull request #21 from paulpai0412/agent/issue-20-reconstruct-go…
paulpai0412 May 7, 2026
2616ab7
Add merge approval override policy
paulpai0412 May 7, 2026
9718874
Update runtime checkpoint approval controls
paulpai0412 May 7, 2026
213d299
Extend approval override policy gate
paulpai0412 May 7, 2026
c778c18
Add PR 22 verifier evidence
paulpai0412 May 7, 2026
b2a3c5d
Merge pull request #22 from paulpai0412/agent/bypass-approval-policy
paulpai0412 May 7, 2026
3665d60
Add session continuation plugin
paulpai0412 May 8, 2026
efb89c6
Compact Phase 1 payload rendering
paulpai0412 May 8, 2026
794e2e9
Update Phase 1 runner to write continuation requests
paulpai0412 May 8, 2026
9aba38a
Rename Phase 1 continuation spec
paulpai0412 May 8, 2026
07e3dde
Merge pull request #23 from paulpai0412/agent/issue-continuation-runner
paulpai0412 May 8, 2026
c526dcb
Record child session open instructions
paulpai0412 May 8, 2026
718d080
Add child session TUI shortcut
paulpai0412 May 8, 2026
16c5f74
Merge pull request #24 from paulpai0412/agent/issue-continuation-runner
paulpai0412 May 8, 2026
b62088b
Use root session continuation metadata
paulpai0412 May 9, 2026
a2a8a1c
Rename root session access commands
paulpai0412 May 9, 2026
ac704d8
Update Phase 1 spec for root sessions
paulpai0412 May 9, 2026
de85147
Merge pull request #25 from paulpai0412/agent/issue-continuation-runner
paulpai0412 May 9, 2026
2cd8925
Add E2E test case issue loop
paulpai0412 May 9, 2026
f3c760d
Extend E2E packet contracts
paulpai0412 May 9, 2026
5fcff3e
Add refactor candidate loop
paulpai0412 May 9, 2026
0982d93
Wire E2E and refactor workflow policy
paulpai0412 May 9, 2026
931f9a9
Update workflow labels and phase audit refs
paulpai0412 May 9, 2026
3b5bbaf
Merge pull request #26 from paulpai0412/agent/e2e-refactor-workflow
paulpai0412 May 9, 2026
e5f71e6
Record phase dashboard verifier evidence
paulpai0412 May 9, 2026
1fd9f41
Clarify verifier compact reference policy
paulpai0412 May 9, 2026
68bd7ff
Mark legacy agent artifacts pre-enforcement
paulpai0412 May 9, 2026
b35f07a
Declare line caps for compact artifacts
paulpai0412 May 9, 2026
ef9b0f6
Generalize context budget artifact gate
paulpai0412 May 9, 2026
25d152b
Merge pull request #27 from paulpai0412/agent/context-budget-governed…
paulpai0412 May 9, 2026
06b1372
Add AC17 dashboard builder target case
paulpai0412 May 9, 2026
41dcfcf
Record issue 28 worker artifacts and PR refs
paulpai0412 May 9, 2026
0b31b28
Tighten AC17 E2E test typing
paulpai0412 May 9, 2026
ddb3027
Record issue 28 verifier evidence
paulpai0412 May 9, 2026
e5cc926
Update issue 28 verification metadata refs
paulpai0412 May 9, 2026
5ba3269
Merge pull request #29 from paulpai0412/agent/issue-28-ac17-e2e-test-…
paulpai0412 May 9, 2026
96acdef
Add deterministic ACTMK SQL correctness coverage
paulpai0412 May 9, 2026
60ea00d
Record issue 31 worker artifacts
paulpai0412 May 9, 2026
3813948
Merge pull request #35 from paulpai0412/agent/issue-31-deterministic-…
paulpai0412 May 9, 2026
aabdd95
Record issue 31 release hygiene state
paulpai0412 May 9, 2026
7cd0ab7
Record issue 31 verifier evidence
paulpai0412 May 9, 2026
86c38af
Prepare issue 32 worker packet
paulpai0412 May 9, 2026
061497b
Add live LLM evidence classification
paulpai0412 May 9, 2026
071ae42
Record issue 32 worker artifacts
paulpai0412 May 9, 2026
f6b8e85
Update issue 32 PR metadata
paulpai0412 May 9, 2026
707df3f
Fix changed-test LSP dict-invariance for issue #32
paulpai0412 May 10, 2026
12669cf
Materialize issue 32 dashboard E2E evidence (#36)
paulpai0412 May 10, 2026
0200368
Materialize issue 33 E2E-003 query-approval-before-chart-spec slice
paulpai0412 May 10, 2026
81f3a37
Record issue 33 worker artifacts
paulpai0412 May 10, 2026
b695e76
Record issue 33 verifier evidence
paulpai0412 May 10, 2026
17741a6
Refresh issue 33 verifier evidence for current PR head
paulpai0412 May 10, 2026
7c95b51
Merge pull request #37 from paulpai0412/agent/issue-33-e2e-query-anal…
paulpai0412 May 10, 2026
b9f3631
Record issue 34 worker artifacts
paulpai0412 May 11, 2026
6041801
Update issue 34 PR metadata
paulpai0412 May 11, 2026
cbc2aa6
Merge pull request #38 from paulpai0412/agent/issue-34-revoked-publis…
paulpai0412 May 11, 2026
fce42fa
docs: design wferp report skill harness
paulpai0412 Jun 18, 2026
1b6d811
docs: add excel formula intake to wferp report design
paulpai0412 Jun 18, 2026
243ed3b
docs: add expense analysis e2e test design
paulpai0412 Jun 18, 2026
8593a15
docs: add wferp report implementation plan
paulpai0412 Jun 18, 2026
b2735e7
docs: design wferp report harness parity
paulpai0412 Jun 18, 2026
124a458
docs: plan wferp report harness parity
paulpai0412 Jun 18, 2026
26628c1
feat: add wferp report harness implementation
paulpai0412 Jun 18, 2026
08550a3
merge: wferp report harness implementation
paulpai0412 Jun 18, 2026
c4420db
docs: complete wferp report skill parity structure
paulpai0412 Jun 18, 2026
72bdf16
test: tighten wferp report skill validator
paulpai0412 Jun 18, 2026
f947738
feat: add checkpoint companion confirmation server
paulpai0412 Jun 18, 2026
561eea9
fix: harden checkpoint companion server
paulpai0412 Jun 18, 2026
c9c78d5
feat: add product checkpoint companion UI
paulpai0412 Jun 18, 2026
7e1d30a
fix: handle checkpoint confirmation preview state
paulpai0412 Jun 18, 2026
34c69a3
feat: parse excel report requirements and formulas
paulpai0412 Jun 18, 2026
1b5b5c9
fix: keep workbook requirement constructor compatible
paulpai0412 Jun 18, 2026
9a49cba
feat: scaffold per-run react report workspaces
paulpai0412 Jun 18, 2026
0b86a0f
fix: harden report scaffold generation
paulpai0412 Jun 18, 2026
192a4b6
feat: add report component policy blocks
paulpai0412 Jun 18, 2026
97ddb8d
fix: harden report table interactions
paulpai0412 Jun 18, 2026
0f907f3
feat: enforce report design catalog metadata
paulpai0412 Jun 18, 2026
990127f
fix: validate report design selections
paulpai0412 Jun 18, 2026
0a57e08
feat: enforce report validators and repair gates
paulpai0412 Jun 18, 2026
cea846d
fix: require explicit residual risk acceptance
paulpai0412 Jun 18, 2026
1b104e0
fix: persist checkpoint confirmation options
paulpai0412 Jun 18, 2026
5ddc379
test: enforce expense report e2e acceptance
paulpai0412 Jun 18, 2026
7f69ac0
feat: wire wferp report harness flow
paulpai0412 Jun 18, 2026
79a7c23
fix: complete harness flow gates
paulpai0412 Jun 18, 2026
03e7201
merge: wferp report harness implementation
paulpai0412 Jun 18, 2026
c75999e
docs: design single html report studio
paulpai0412 Jun 18, 2026
ed1afe8
docs: plan single html report studio
paulpai0412 Jun 18, 2026
f368d5e
feat: build verified report package
paulpai0412 Jun 18, 2026
c663f50
feat: add dynamic report design brief
paulpai0412 Jun 18, 2026
62205cf
feat: add visual design checkpoint
paulpai0412 Jun 18, 2026
b4aeef3
feat: export single html report
paulpai0412 Jun 18, 2026
94316e6
feat: validate single html safety
paulpai0412 Jun 18, 2026
f1ba295
feat: add offline report interactions
paulpai0412 Jun 18, 2026
ca54f79
feat: add report style replay capsule
paulpai0412 Jun 18, 2026
b1517d5
test: add single html expense e2e
paulpai0412 Jun 18, 2026
82a419c
test: add style replay e2e
paulpai0412 Jun 18, 2026
4ca19d9
docs: document single html report studio skill flow
paulpai0412 Jun 18, 2026
9ce4a34
test: add expense harness report evidence
paulpai0412 Jun 19, 2026
10d4c71
merge: wferp report evidence
paulpai0412 Jun 19, 2026
8816100
Improve wferp checkpoint companion previews
paulpai0412 Jun 19, 2026
6a68e24
Merge codex/wferp-report-impl
paulpai0412 Jun 19, 2026
31043a1
docs: design sqlite enrichment for wferp report
paulpai0412 Jun 19, 2026
3089f5c
docs: plan sqlite enrichment for wferp report
paulpai0412 Jun 19, 2026
3fef5ce
feat: add readable schema metadata
paulpai0412 Jun 19, 2026
628bc20
feat: classify workbook fields for sqlite enrichment
paulpai0412 Jun 19, 2026
f6f7e57
feat: add run scoped sqlite workspace
paulpai0412 Jun 19, 2026
44f004b
feat: import workbook lookups into sqlite
paulpai0412 Jun 19, 2026
d3461f9
feat: enrich workbook formulas in sqlite
paulpai0412 Jun 19, 2026
4eecc83
feat: add sqlite enrichment checkpoints
paulpai0412 Jun 19, 2026
a4f55b4
feat: tighten report validator gates
paulpai0412 Jun 19, 2026
7c2d5f7
test: cover sqlite enrichment expense e2e
paulpai0412 Jun 19, 2026
efc454b
docs: record sqlite enrichment completion evidence
paulpai0412 Jun 19, 2026
0d171dc
Merge codex/wferp-report-impl
paulpai0412 Jun 19, 2026
db0b97a
fix: require llm-first report harness mapping
paulpai0412 Jun 19, 2026
149f833
fix: use codex oauth llm provider
paulpai0412 Jun 19, 2026
5045da3
docs: publish wferp report skill package
paulpai0412 Jun 19, 2026
aa4349a
test: cover report harness checkpoint definitions
paulpai0412 Jun 19, 2026
ee2cfae
Merge codex/wferp-report-impl
paulpai0412 Jun 19, 2026
cc47fbf
feat: validate generated report sections
paulpai0412 Jun 19, 2026
91f050b
Merge codex/wferp-report-impl
paulpai0412 Jun 19, 2026
f02c785
docs: add windows encoding support for wferp report skill
paulpai0412 Jun 19, 2026
8d628c9
Merge codex/wferp-report-impl
paulpai0412 Jun 19, 2026
7e7572d
Initialize WFERP repository
ivychi Jun 20, 2026
0e2753a
Merge local WFERP workspace into main
ivychi Jun 20, 2026
26065cc
docs: design 4-step wferp visual companion
ivychi Jun 20, 2026
12a9c79
docs: clarify visual companion plugin gates
ivychi Jun 20, 2026
2ea30d1
docs: add wferp harness state machine contract
ivychi Jun 20, 2026
c0a9b22
docs: plan four-step wferp companion implementation
ivychi Jun 20, 2026
2b3351c
chore: ignore local worktrees
ivychi Jun 20, 2026
25dac3f
feat: add wferp harness state machine
ivychi Jun 20, 2026
5b31450
feat: implement stateful four-step wferp companion
ivychi Jun 20, 2026
0d350da
test: fix pytest tmpdir acl on windows
ivychi Jun 20, 2026
1f62161
docs: document pytest windows acl workaround
ivychi Jun 20, 2026
abf33ca
test: complete wferp companion regression verification
ivychi Jun 20, 2026
7b16f3f
docs: reinforce wferp harness gate rules
ivychi Jun 20, 2026
1ba0876
merge: wferp four-step visual companion
ivychi Jun 20, 2026
473b5c4
Harden report harness UTF-8 gates
ivychi Jun 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
__pycache__/
*.py[cod]
.pytest_cache/
.playwright-mcp/
.worktrees/
prompt.txt

# Local portable tool payloads and downloads. Keep small wrappers/scripts only.
.tools/git/
.tools/gh/
.tools/downloads/

# Local downloads, caches, and generated report runs.
.download_wferp_*/
.download_wferp_skill_*/
.opencode/
.pytest-tmp/
.tmp/
.wferp-llm-temp/
pytest-cache-files-*/
wferp-report-runs/

# Runtime artifacts.
*.sqlite3
*.db
*.log
15 changes: 15 additions & 0 deletions .opencode/commands/phase1-start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
description: Start the Phase 1 orchestrator checkpoint-to-new-session flow for a selected AFK issue packet
agent: build
subtask: false
---

Run the Phase 1 orchestrator checkpoint-to-new-session runner for issue packet `$ARGUMENTS`.

1. Execute:
!`python3 scripts/phase1_orchestrator_runner.py --issue-packet $ARGUMENTS`
2. Read `docs/agents/runtime/context-checkpoint.yaml` after the runner updates it.
3. Read `.opencode/runtime/new-session-request.json` after the runner writes it.
4. Tell me the checkpoint update result, the continuation request path, and the immediate next action.

Do not start worker execution yet. Stop after reporting the runner output and the generated continuation request.
26 changes: 26 additions & 0 deletions .opencode/commands/show-last-root-session.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
description: Show the latest continuation root session and how to open it
agent: build
subtask: false
---

Read `.opencode/runtime/new-session-result.json`.

Report these fields when present:
- `status`
- `title`
- `reason`
- `sourceSessionID`
- `rootSessionID`
- `recordedAt`
- `tuiResumeCommand`
- `cliOpenCommand`
- `recommendedAction`
- `error`

If `status` is `success`, tell me exactly how to inspect the root session:
1. In OpenCode TUI, run `/sessions` and switch to `rootSessionID`.
2. Or run `cliOpenCommand` from a shell.
3. In this repo's OpenCode TUI, run `/open-last-root-session` to jump directly to `rootSessionID`.

If `status` is `error`, explain that no root session is available yet and include the recorded error.
9 changes: 9 additions & 0 deletions .opencode/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"plugin": [
"./plugins/session-continuation.ts",
"./plugins/session-continuation-tui.ts"
],
"dependencies": {
"@opencode-ai/plugin": "1.14.33"
}
}
67 changes: 67 additions & 0 deletions .opencode/plugins/session-continuation-tui.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { readFile } from "node:fs/promises"
import { join } from "node:path"

import type { TuiPluginModule } from "@opencode-ai/plugin/dist/tui"

type NewSessionResult = {
status?: "success" | "error"
rootSessionID?: string
title?: string
error?: string
}

const NEW_SESSION_RESULT_RELATIVE_PATH = ".opencode/runtime/new-session-result.json"

async function readLatestSessionResult(worktree: string): Promise<NewSessionResult | undefined> {
try {
const resultText = await readFile(join(worktree, NEW_SESSION_RESULT_RELATIVE_PATH), "utf-8")
return JSON.parse(resultText) as NewSessionResult
} catch {
return undefined
}
}

const SessionContinuationTuiPlugin: TuiPluginModule = {
tui: async (api) => {
api.command.register(() => [
{
title: "Open last root session",
value: "open-last-root-session",
description: "Open the latest continuation root session recorded by the session continuation plugin.",
category: "Session",
slash: {
name: "open-last-root-session",
},
onSelect: async () => {
const result = await readLatestSessionResult(api.state.path.worktree)
if (!result) {
api.ui.toast({
variant: "error",
title: "No continuation result",
message: "No .opencode/runtime/new-session-result.json file was found.",
})
return
}
if (result.status !== "success" || !result.rootSessionID) {
api.ui.toast({
variant: "error",
title: "Root session unavailable",
message: result.error ?? "The latest continuation result does not contain a root session.",
})
return
}
api.route.navigate("session", { sessionID: result.rootSessionID })
api.ui.toast({
variant: "success",
title: "Opened root session",
message: result.title
? `Switched to ${result.rootSessionID} (${result.title}).`
: `Switched to ${result.rootSessionID}.`,
})
},
},
])
},
}

export default SessionContinuationTuiPlugin
175 changes: 175 additions & 0 deletions .opencode/plugins/session-continuation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
import { mkdir, readFile, rm, writeFile } from "node:fs/promises"
import { join } from "node:path"

import { type Plugin, tool } from "@opencode-ai/plugin"

const NEW_SESSION_REQUEST_RELATIVE_PATH = ".opencode/runtime/new-session-request.json"
const NEW_SESSION_RESULT_RELATIVE_PATH = ".opencode/runtime/new-session-result.json"

type NewSessionRequest = {
reason?: string
title?: string
agent?: string
prompt?: string
}

type NewSessionResult = {
status: "success" | "error"
sourceSessionID: string
rootSessionID?: string
title: string
reason?: string
error?: string
tuiResumeCommand?: string
cliOpenCommand?: string
recommendedAction?: string
recordedAt: string
}

const SAFE_PRIMARY_AGENTS = new Set(["build", "plan"])

async function consumeNewSessionRequest(worktree: string): Promise<NewSessionRequest | undefined> {
const requestPath = join(worktree, NEW_SESSION_REQUEST_RELATIVE_PATH)
try {
const requestText = await readFile(requestPath, "utf-8")
await rm(requestPath, { force: true })
return JSON.parse(requestText)
} catch {
return undefined
}
}

async function writeNewSessionResult(worktree: string, result: NewSessionResult): Promise<void> {
const resultPath = join(worktree, NEW_SESSION_RESULT_RELATIVE_PATH)
await mkdir(join(worktree, ".opencode/runtime"), { recursive: true })
await writeFile(resultPath, `${JSON.stringify(result, null, 2)}\n`, "utf-8")
}

function buildNewSessionPrompt(request: NewSessionRequest): string {
return (
request.prompt ??
[
"Resume the autonomous Workflow ERP development workflow from checkpoint only.",
"Read docs/agents/runtime/context-checkpoint.yaml first.",
"Do not import or rely on the prior session transcript.",
"Use compact_payload.authoritative_refs and compact_payload.immediate_next_action as the source of truth.",
"Continue with the next workflow action, preserving repo role boundaries and checkpoint-only resume policy.",
].join("\n")
)
}

function resolveBootstrapAgent(request: NewSessionRequest): string {
if (!request.agent) return "build"
const normalizedAgent = request.agent.trim().toLowerCase()
return SAFE_PRIMARY_AGENTS.has(normalizedAgent) ? normalizedAgent : "build"
}

async function continueInNewSession(
client: Parameters<Plugin>[0]["client"],
directory: string,
request: NewSessionRequest,
): Promise<{ rootSessionID: string; title: string }> {
const title = request.title ?? "Continue workflow from checkpoint"
const created = await client.session.create({
query: { directory },
body: {
title,
},
})
if (created.error) {
throw new Error(`OpenCode session.create failed: ${String(created.error)}`)
}

const rootSessionID = created.data?.id
if (!rootSessionID) {
throw new Error("OpenCode session.create did not return a root session id")
}

const promptResult = await client.session.promptAsync({
path: { id: rootSessionID },
query: { directory },
body: {
agent: resolveBootstrapAgent(request),
parts: [
{
type: "text",
text: buildNewSessionPrompt(request),
},
],
},
})
if (promptResult.error) {
throw new Error(`OpenCode session.promptAsync failed: ${String(promptResult.error)}`)
}

return { rootSessionID, title }
}

export const SessionContinuationPlugin: Plugin = async ({ client, directory, worktree }) => {
return {
event: async ({ event }) => {
if (event.type !== "session.idle") return

const newSessionRequest = await consumeNewSessionRequest(worktree)
if (!newSessionRequest) return

try {
const result = await continueInNewSession(client, directory, newSessionRequest)
await writeNewSessionResult(worktree, {
status: "success",
sourceSessionID: event.properties.sessionID,
rootSessionID: result.rootSessionID,
title: result.title,
reason: newSessionRequest.reason,
tuiResumeCommand: "/sessions",
cliOpenCommand: `opencode --session ${result.rootSessionID}`,
recommendedAction:
`Open /sessions in OpenCode TUI and switch to ${result.rootSessionID}, ` +
`or run opencode --session ${result.rootSessionID}.`,
recordedAt: new Date().toISOString(),
})
} catch (error) {
await writeNewSessionResult(worktree, {
status: "error",
sourceSessionID: event.properties.sessionID,
title: newSessionRequest.title ?? "Continue workflow from checkpoint",
reason: newSessionRequest.reason,
error: error instanceof Error ? error.message : String(error),
recordedAt: new Date().toISOString(),
})
}
},
tool: {
continue_in_new_session: tool({
description:
"Create a fresh OpenCode root session and prompt it to resume this repo workflow from docs/agents/runtime/context-checkpoint.yaml.",
args: {
reason: tool.schema.string().optional().describe("Why a fresh continuation session is being created."),
title: tool.schema.string().optional().describe("Optional title for the root session."),
agent: tool.schema.string().optional().describe("Optional OpenCode agent name for the bootstrap prompt."),
prompt: tool.schema.string().optional().describe("Optional custom bootstrap prompt."),
},
async execute(args, context) {
context.metadata({
title: "Continue in new session",
metadata: {
sessionID: context.sessionID,
reason: args.reason ?? "not specified",
},
})

const result = await continueInNewSession(client, context.directory, args)

return {
output: `Created root continuation session ${result.rootSessionID} from ${context.sessionID}.`,
metadata: {
sourceSessionID: context.sessionID,
rootSessionID: result.rootSessionID,
title: result.title,
},
}
},
}),
},
}
}
9 changes: 9 additions & 0 deletions .tools/activate.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@echo off
chcp 65001 >nul
set "PYTHONUTF8=1"
set "PYTHONIOENCODING=utf-8"
set "TOOL_BIN=%~dp0bin"
set "CODEX_PYTHON=C:\Users\ivychi\.cache\codex-runtimes\codex-primary-runtime\dependencies\python"
set "NODE_HOME=C:\Users\ivychi\util\nodejs"
set "PATH=%TOOL_BIN%;%CODEX_PYTHON%;%NODE_HOME%;%PATH%"
echo WFERP local tools are active for this cmd session.
26 changes: 26 additions & 0 deletions .tools/activate.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
$RepoRoot = Split-Path -Parent $PSScriptRoot

chcp 65001 > $null
[Console]::InputEncoding = [System.Text.UTF8Encoding]::new($false)
[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false)
$OutputEncoding = [System.Text.UTF8Encoding]::new($false)
$env:PYTHONUTF8 = "1"
$env:PYTHONIOENCODING = "utf-8"

$Paths = @(
(Join-Path $PSScriptRoot "bin"),
"C:\Users\ivychi\.cache\codex-runtimes\codex-primary-runtime\dependencies\python",
"C:\Users\ivychi\util\nodejs"
)

$PathsToAdd = $Paths.Clone()
[array]::Reverse($PathsToAdd)

foreach ($Path in $PathsToAdd) {
if ((Test-Path $Path) -and (($env:Path -split ";") -notcontains $Path)) {
$env:Path = "$Path;$env:Path"
}
}

Write-Host "WFERP local tools are active for this PowerShell session."
Write-Host "Repo: $RepoRoot"
2 changes: 2 additions & 0 deletions .tools/bin/gh.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
"%~dp0..\gh\gh.exe" %*
2 changes: 2 additions & 0 deletions .tools/bin/git.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
"%~dp0..\git\cmd\git.exe" %*
7 changes: 7 additions & 0 deletions .tools/bin/pytest.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off
set "CODEX_PYTHON=C:\Users\ivychi\.cache\codex-runtimes\codex-primary-runtime\dependencies\python\python.exe"
if exist "%CODEX_PYTHON%" (
"%CODEX_PYTHON%" -m pytest %*
) else (
py -3 -m pytest %*
)
7 changes: 7 additions & 0 deletions .tools/bin/python.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off
set "CODEX_PYTHON=C:\Users\ivychi\.cache\codex-runtimes\codex-primary-runtime\dependencies\python\python.exe"
if exist "%CODEX_PYTHON%" (
"%CODEX_PYTHON%" %*
) else (
py -3 %*
)
Loading