takomi 2.1.37 → 2.1.39

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 (90) hide show
  1. package/.agents/plugins/marketplace.json +32 -0
  2. package/.pi/agents/architect.md +4 -2
  3. package/.pi/agents/designer.md +2 -0
  4. package/.pi/agents/orchestrator.md +4 -0
  5. package/.pi/prompts/design-prompt.md +3 -1
  6. package/.pi/prompts/genesis-prompt.md +2 -0
  7. package/.pi/prompts/takomi-prompt.md +6 -3
  8. package/.pi/takomi/policies/subagent-routing.md +9 -1
  9. package/.pi/takomi/policies/takomi-lifecycle-routing.md +3 -1
  10. package/README.md +27 -5
  11. package/assets/.agent/skills/takomi-flow/SKILL.md +235 -0
  12. package/assets/.agent/workflows/README.md +3 -3
  13. package/assets/.agent/workflows/mode-architect.md +7 -5
  14. package/assets/.agent/workflows/vibe-design.md +3 -1
  15. package/assets/.agent/workflows/vibe-genesis.md +2 -0
  16. package/assets/Takomi-Agents/custom_modes.yaml +1253 -1252
  17. package/assets/Takomi-Agents/vibe-architect.yaml +11 -6
  18. package/assets/Takomi-Agents/vibe-orchestrator.yaml +2 -2
  19. package/docs/features/TakomiFlow_Portable_Plugin.md +78 -0
  20. package/docs/takomi-flow-onboarding.md +76 -0
  21. package/docs/takomi-flow-public-distribution.md +94 -0
  22. package/package.json +19 -2
  23. package/plugins/takomi-codex/.codex-plugin/plugin.json +37 -0
  24. package/plugins/takomi-codex/assets/composer-icon.png +0 -0
  25. package/plugins/takomi-codex/assets/logo-dark.png +0 -0
  26. package/plugins/takomi-codex/assets/logo.png +0 -0
  27. package/plugins/takomi-codex/scripts/takomi-board.ps1 +197 -0
  28. package/plugins/takomi-codex/scripts/takomi-detect.ps1 +125 -0
  29. package/plugins/takomi-codex/scripts/takomi-doctor.ps1 +88 -0
  30. package/plugins/takomi-codex/scripts/takomi-harness.ps1 +52 -0
  31. package/plugins/takomi-codex/scripts/takomi-pi-dispatch.ps1 +93 -0
  32. package/plugins/takomi-codex/scripts/takomi-policy.ps1 +108 -0
  33. package/plugins/takomi-codex/skills/takomi-codex/SKILL.md +194 -0
  34. package/plugins/takomi-flow/.codex-plugin/plugin.json +36 -0
  35. package/plugins/takomi-flow/.mcp.json +11 -0
  36. package/plugins/takomi-flow/assets/capabilities.json +171 -0
  37. package/plugins/takomi-flow/assets/collection.schema.json +29 -0
  38. package/plugins/takomi-flow/assets/composer-icon.png +0 -0
  39. package/plugins/takomi-flow/assets/examples.json +94 -0
  40. package/plugins/takomi-flow/assets/logo-dark.png +0 -0
  41. package/plugins/takomi-flow/assets/logo.png +0 -0
  42. package/plugins/takomi-flow/assets/request.schema.json +67 -0
  43. package/plugins/takomi-flow/assets/result.schema.json +45 -0
  44. package/plugins/takomi-flow/assets/templates/image-request.json +13 -0
  45. package/plugins/takomi-flow/assets/templates/video-request.json +15 -0
  46. package/plugins/takomi-flow/package.json +38 -0
  47. package/plugins/takomi-flow/pnpm-lock.yaml +813 -0
  48. package/plugins/takomi-flow/references/flow-provider-contract.md +326 -0
  49. package/plugins/takomi-flow/scripts/lib/agent-plan.mjs +130 -0
  50. package/plugins/takomi-flow/scripts/lib/api.mjs +113 -0
  51. package/plugins/takomi-flow/scripts/lib/args.mjs +57 -0
  52. package/plugins/takomi-flow/scripts/lib/audit.mjs +65 -0
  53. package/plugins/takomi-flow/scripts/lib/browser.mjs +39 -0
  54. package/plugins/takomi-flow/scripts/lib/capabilities.mjs +11 -0
  55. package/plugins/takomi-flow/scripts/lib/collect.mjs +53 -0
  56. package/plugins/takomi-flow/scripts/lib/commands.mjs +175 -0
  57. package/plugins/takomi-flow/scripts/lib/doctor.mjs +77 -0
  58. package/plugins/takomi-flow/scripts/lib/examples.mjs +17 -0
  59. package/plugins/takomi-flow/scripts/lib/flow-outcome.mjs +90 -0
  60. package/plugins/takomi-flow/scripts/lib/flow-ui.mjs +165 -0
  61. package/plugins/takomi-flow/scripts/lib/generation.mjs +90 -0
  62. package/plugins/takomi-flow/scripts/lib/inspect.mjs +81 -0
  63. package/plugins/takomi-flow/scripts/lib/mcp-prompts.mjs +39 -0
  64. package/plugins/takomi-flow/scripts/lib/mcp-resources.mjs +16 -0
  65. package/plugins/takomi-flow/scripts/lib/mcp-tools.mjs +150 -0
  66. package/plugins/takomi-flow/scripts/lib/media.mjs +78 -0
  67. package/plugins/takomi-flow/scripts/lib/observe.mjs +54 -0
  68. package/plugins/takomi-flow/scripts/lib/paths.mjs +37 -0
  69. package/plugins/takomi-flow/scripts/lib/playwright-loader.mjs +23 -0
  70. package/plugins/takomi-flow/scripts/lib/prompts.mjs +72 -0
  71. package/plugins/takomi-flow/scripts/lib/report.mjs +141 -0
  72. package/plugins/takomi-flow/scripts/lib/request-validator.mjs +58 -0
  73. package/plugins/takomi-flow/scripts/lib/request.mjs +55 -0
  74. package/plugins/takomi-flow/scripts/lib/resource-files.mjs +69 -0
  75. package/plugins/takomi-flow/scripts/lib/result.mjs +31 -0
  76. package/plugins/takomi-flow/scripts/lib/review.mjs +44 -0
  77. package/plugins/takomi-flow/scripts/lib/selftest.mjs +153 -0
  78. package/plugins/takomi-flow/scripts/lib/settings-plan.mjs +39 -0
  79. package/plugins/takomi-flow/scripts/lib/templates.mjs +37 -0
  80. package/plugins/takomi-flow/scripts/lib/trusted-chrome.mjs +67 -0
  81. package/plugins/takomi-flow/scripts/lib/workflow.mjs +56 -0
  82. package/plugins/takomi-flow/scripts/mcp-server.mjs +18 -0
  83. package/plugins/takomi-flow/scripts/mcp-smoke.mjs +142 -0
  84. package/plugins/takomi-flow/scripts/takomi-flow.mjs +17 -0
  85. package/plugins/takomi-flow/skills/takomi-flow/SKILL.md +235 -0
  86. package/plugins/takomi-flow/skills/takomi-flow/agents/openai.yaml +7 -0
  87. package/scripts/install-takomi-flow.ps1 +85 -0
  88. package/src/pi-takomi-core/orchestration.ts +1 -1
  89. package/src/pi-takomi-core/workflows.ts +4 -4
  90. package/src/skills-catalog.js +11 -7
@@ -0,0 +1,125 @@
1
+ param(
2
+ [string]$Root,
3
+ [switch]$Json
4
+ )
5
+
6
+ $ErrorActionPreference = "Stop"
7
+
8
+ function Get-DefaultRoot {
9
+ $pluginRoot = Split-Path -Parent $PSScriptRoot
10
+ $pluginsRoot = Split-Path -Parent $pluginRoot
11
+ return Split-Path -Parent $pluginsRoot
12
+ }
13
+
14
+ function Resolve-PathSafe([string]$PathValue) {
15
+ if ([string]::IsNullOrWhiteSpace($PathValue)) { return $null }
16
+ try { return (Resolve-Path -LiteralPath $PathValue -ErrorAction Stop).Path } catch { return $PathValue }
17
+ }
18
+
19
+ function Test-File([string]$PathValue) {
20
+ return [bool](Test-Path -LiteralPath $PathValue -PathType Leaf)
21
+ }
22
+
23
+ function Test-Dir([string]$PathValue) {
24
+ return [bool](Test-Path -LiteralPath $PathValue -PathType Container)
25
+ }
26
+
27
+ function Get-CommandInfo([string]$Name, [string[]]$VersionArgs) {
28
+ $cmd = Get-Command $Name -ErrorAction SilentlyContinue
29
+ if (-not $cmd) {
30
+ return [pscustomobject]@{ available = $false; path = $null; version = $null }
31
+ }
32
+
33
+ $version = $null
34
+ foreach ($args in $VersionArgs) {
35
+ try {
36
+ $parts = $args -split " "
37
+ $output = & $cmd.Source @parts 2>$null | Select-Object -First 1
38
+ if ($output) {
39
+ $version = [string]$output
40
+ break
41
+ }
42
+ } catch { }
43
+ }
44
+
45
+ return [pscustomobject]@{
46
+ available = $true
47
+ path = $cmd.Source
48
+ version = $version
49
+ }
50
+ }
51
+
52
+ $projectRoot = Resolve-PathSafe ($(if ($Root) { $Root } else { Get-DefaultRoot }))
53
+ $homeDir = [Environment]::GetFolderPath("UserProfile")
54
+ $pluginRoot = Split-Path -Parent $PSScriptRoot
55
+
56
+ $projectPi = Join-Path $projectRoot ".pi"
57
+ $projectAgents = Join-Path $projectPi "agents"
58
+ $projectPrompts = Join-Path $projectPi "prompts"
59
+ $projectPolicies = Join-Path $projectPi "takomi\policies"
60
+ $projectSettings = Join-Path $projectPi "settings.json"
61
+ $projectProfile = Join-Path $projectPi "takomi-profile.json"
62
+ $projectRouting = Join-Path $projectPi "takomi\model-routing.md"
63
+ $roadbooks = Join-Path $projectRoot "docs\tasks\orchestrator-sessions"
64
+
65
+ $userPiAgent = Join-Path $homeDir ".pi\agent"
66
+ $userAgentsSkills = Join-Path $homeDir ".agents\skills"
67
+
68
+ $result = [pscustomobject]@{
69
+ projectRoot = $projectRoot
70
+ pluginRoot = $pluginRoot
71
+ project = [pscustomobject]@{
72
+ pi = Test-Dir $projectPi
73
+ settings = Test-File $projectSettings
74
+ profile = Test-File $projectProfile
75
+ routingPolicy = Test-File $projectRouting
76
+ policies = Test-Dir $projectPolicies
77
+ agents = Test-Dir $projectAgents
78
+ prompts = Test-Dir $projectPrompts
79
+ roadbooks = Test-Dir $roadbooks
80
+ }
81
+ user = [pscustomobject]@{
82
+ piAgent = Test-Dir $userPiAgent
83
+ agentsSkills = Test-Dir $userAgentsSkills
84
+ }
85
+ cli = [pscustomobject]@{
86
+ takomi = Get-CommandInfo "takomi" @("--version", "version")
87
+ pi = Get-CommandInfo "pi" @("--version", "version")
88
+ }
89
+ paths = [pscustomobject]@{
90
+ projectPi = $projectPi
91
+ projectSettings = $projectSettings
92
+ projectProfile = $projectProfile
93
+ projectRouting = $projectRouting
94
+ projectPolicies = $projectPolicies
95
+ roadbooks = $roadbooks
96
+ userPiAgent = $userPiAgent
97
+ userAgentsSkills = $userAgentsSkills
98
+ }
99
+ }
100
+
101
+ if ($Json) {
102
+ $result | ConvertTo-Json -Depth 8
103
+ exit 0
104
+ }
105
+
106
+ Write-Output "Takomi Codex detection"
107
+ Write-Output "Project: $($result.projectRoot)"
108
+ Write-Output "Plugin: $($result.pluginRoot)"
109
+ Write-Output ""
110
+ Write-Output "Project runtime:"
111
+ Write-Output " .pi: $($result.project.pi)"
112
+ Write-Output " settings: $($result.project.settings)"
113
+ Write-Output " profile: $($result.project.profile)"
114
+ Write-Output " routing policy: $($result.project.routingPolicy)"
115
+ Write-Output " policies: $($result.project.policies)"
116
+ Write-Output " agents/prompts: $($result.project.agents) / $($result.project.prompts)"
117
+ Write-Output " roadbooks: $($result.project.roadbooks)"
118
+ Write-Output ""
119
+ Write-Output "User runtime:"
120
+ Write-Output " ~/.pi/agent: $($result.user.piAgent)"
121
+ Write-Output " ~/.agents/skills:$($result.user.agentsSkills)"
122
+ Write-Output ""
123
+ Write-Output "CLI:"
124
+ Write-Output " takomi: $($result.cli.takomi.available) $($result.cli.takomi.version)"
125
+ Write-Output " pi: $($result.cli.pi.available) $($result.cli.pi.version)"
@@ -0,0 +1,88 @@
1
+ param(
2
+ [string]$Root
3
+ )
4
+
5
+ $ErrorActionPreference = "Stop"
6
+
7
+ function Get-DefaultRoot {
8
+ $pluginRoot = Split-Path -Parent $PSScriptRoot
9
+ $pluginsRoot = Split-Path -Parent $pluginRoot
10
+ return Split-Path -Parent $pluginsRoot
11
+ }
12
+
13
+ function Add-Check([System.Collections.Generic.List[object]]$Checks, [string]$Name, [bool]$Ok, [string]$Detail, [string]$Fix = "") {
14
+ $Checks.Add([pscustomobject]@{
15
+ name = $Name
16
+ ok = $Ok
17
+ detail = $Detail
18
+ fix = $Fix
19
+ }) | Out-Null
20
+ }
21
+
22
+ function Test-JsonFile([string]$PathValue) {
23
+ try {
24
+ Get-Content -Raw -LiteralPath $PathValue | ConvertFrom-Json | Out-Null
25
+ return $true
26
+ } catch {
27
+ return $false
28
+ }
29
+ }
30
+
31
+ $projectRoot = if ($Root) { $Root } else { Get-DefaultRoot }
32
+ $projectRoot = (Resolve-Path -LiteralPath $projectRoot).Path
33
+ $pluginRoot = Split-Path -Parent $PSScriptRoot
34
+ $manifest = Join-Path $pluginRoot ".codex-plugin\plugin.json"
35
+ $skillFile = Join-Path $pluginRoot "skills\takomi-codex\SKILL.md"
36
+ $detectScript = Join-Path $pluginRoot "scripts\takomi-detect.ps1"
37
+ $boardScript = Join-Path $pluginRoot "scripts\takomi-board.ps1"
38
+ $policyScript = Join-Path $pluginRoot "scripts\takomi-policy.ps1"
39
+ $dispatchScript = Join-Path $pluginRoot "scripts\takomi-pi-dispatch.ps1"
40
+ $harnessScript = Join-Path $pluginRoot "scripts\takomi-harness.ps1"
41
+
42
+ $checks = [System.Collections.Generic.List[object]]::new()
43
+
44
+ Add-Check $checks "plugin manifest exists" (Test-Path -LiteralPath $manifest -PathType Leaf) $manifest
45
+ Add-Check $checks "plugin manifest is valid json" (Test-JsonFile $manifest) $manifest
46
+
47
+ if (Test-Path -LiteralPath $manifest -PathType Leaf) {
48
+ $parsed = Get-Content -Raw -LiteralPath $manifest | ConvertFrom-Json
49
+ Add-Check $checks "plugin name" ($parsed.name -eq "takomi-codex") "name=$($parsed.name)"
50
+ Add-Check $checks "skills path" ($parsed.skills -eq "./skills/") "skills=$($parsed.skills)"
51
+ Add-Check $checks "default prompts array" ($parsed.interface.defaultPrompt -is [array]) "defaultPrompt type=$($parsed.interface.defaultPrompt.GetType().Name)" "Use an array with up to three prompts."
52
+ }
53
+
54
+ Add-Check $checks "skill entrypoint exists" (Test-Path -LiteralPath $skillFile -PathType Leaf) $skillFile
55
+ Add-Check $checks "detect script exists" (Test-Path -LiteralPath $detectScript -PathType Leaf) $detectScript
56
+ Add-Check $checks "board script exists" (Test-Path -LiteralPath $boardScript -PathType Leaf) $boardScript
57
+ Add-Check $checks "policy script exists" (Test-Path -LiteralPath $policyScript -PathType Leaf) $policyScript
58
+ Add-Check $checks "dispatch script exists" (Test-Path -LiteralPath $dispatchScript -PathType Leaf) $dispatchScript
59
+ Add-Check $checks "harness script exists" (Test-Path -LiteralPath $harnessScript -PathType Leaf) $harnessScript
60
+
61
+ $detect = & $detectScript -Root $projectRoot -Json | ConvertFrom-Json
62
+ Add-Check $checks "project root readable" (Test-Path -LiteralPath $projectRoot -PathType Container) $projectRoot
63
+ Add-Check $checks "project .pi detected" ([bool]$detect.project.pi) $detect.paths.projectPi "Run takomi setup project if this repo should have a local Pi runtime."
64
+ Add-Check $checks "project routing policy detected" ([bool]$detect.project.routingPolicy) $detect.paths.projectRouting "Add .pi/takomi/model-routing.md if model routing should be project-owned."
65
+ Add-Check $checks "takomi cli available" ([bool]$detect.cli.takomi.available) ($detect.cli.takomi.path ?? "missing") "Install or expose the takomi CLI if Pi dispatch should be available."
66
+ Add-Check $checks "pi cli available" ([bool]$detect.cli.pi.available) ($detect.cli.pi.path ?? "missing") "Install or expose Pi if direct Pi launch should be available."
67
+
68
+ $failed = $checks | Where-Object { -not $_.ok }
69
+
70
+ Write-Output "Takomi Codex doctor"
71
+ Write-Output "Project: $projectRoot"
72
+ Write-Output "Plugin: $pluginRoot"
73
+ Write-Output ""
74
+
75
+ foreach ($check in $checks) {
76
+ $mark = if ($check.ok) { "OK " } else { "WARN" }
77
+ Write-Output "[$mark] $($check.name): $($check.detail)"
78
+ if (-not $check.ok -and $check.fix) {
79
+ Write-Output " fix: $($check.fix)"
80
+ }
81
+ }
82
+
83
+ Write-Output ""
84
+ if ($failed.Count -eq 0) {
85
+ Write-Output "Takomi Codex doctor passed."
86
+ } else {
87
+ Write-Output "Takomi Codex doctor found $($failed.Count) item(s) to review."
88
+ }
@@ -0,0 +1,52 @@
1
+ param(
2
+ [ValidateSet("status", "harnesses", "sync", "setup", "refresh")]
3
+ [string]$Action = "status",
4
+ [string]$Root,
5
+ [string]$Target = "",
6
+ [switch]$Execute
7
+ )
8
+
9
+ $ErrorActionPreference = "Stop"
10
+
11
+ function Get-DefaultRoot {
12
+ $pluginRoot = Split-Path -Parent $PSScriptRoot
13
+ $pluginsRoot = Split-Path -Parent $pluginRoot
14
+ return Split-Path -Parent $pluginsRoot
15
+ }
16
+
17
+ function Get-Takomi {
18
+ $cmd = Get-Command "takomi" -ErrorAction SilentlyContinue
19
+ if (-not $cmd) { throw "takomi CLI is not available." }
20
+ return $cmd.Source
21
+ }
22
+
23
+ $projectRoot = if ($Root) { $Root } else { Get-DefaultRoot }
24
+ $projectRoot = (Resolve-Path -LiteralPath $projectRoot).Path
25
+ $takomi = Get-Takomi
26
+
27
+ $argsList = switch ($Action) {
28
+ "status" { @("status") }
29
+ "harnesses" { @("harnesses") }
30
+ "sync" { if ($Target) { @("sync", $Target) } else { @("sync") } }
31
+ "setup" { if ($Target) { @("setup", $Target) } else { @("setup") } }
32
+ "refresh" { if ($Target) { @("refresh", $Target) } else { @("refresh") } }
33
+ }
34
+
35
+ Write-Output "Takomi harness bridge"
36
+ Write-Output "Project: $projectRoot"
37
+ Write-Output "Mode: $(if ($Execute) { "execute" } else { "dry-run" })"
38
+ Write-Output "Command: $takomi $($argsList -join ' ')"
39
+ Write-Output ""
40
+
41
+ if (-not $Execute) {
42
+ Write-Output "Dry run only. Re-run with -Execute after confirming the target harness and write scope."
43
+ exit 0
44
+ }
45
+
46
+ Push-Location $projectRoot
47
+ try {
48
+ & $takomi @argsList
49
+ exit $LASTEXITCODE
50
+ } finally {
51
+ Pop-Location
52
+ }
@@ -0,0 +1,93 @@
1
+ param(
2
+ [ValidateSet("status", "doctor", "launch", "takomi", "pi")]
3
+ [string]$Action = "status",
4
+ [string]$Root,
5
+ [string]$ArgsLine = "",
6
+ [switch]$Execute
7
+ )
8
+
9
+ $ErrorActionPreference = "Stop"
10
+
11
+ function Get-DefaultRoot {
12
+ $pluginRoot = Split-Path -Parent $PSScriptRoot
13
+ $pluginsRoot = Split-Path -Parent $pluginRoot
14
+ return Split-Path -Parent $pluginsRoot
15
+ }
16
+
17
+ function Get-Tool([string]$Name) {
18
+ return Get-Command $Name -ErrorAction SilentlyContinue
19
+ }
20
+
21
+ function Split-ArgsLine([string]$Text) {
22
+ if ([string]::IsNullOrWhiteSpace($Text)) { return @() }
23
+ return [System.Management.Automation.PSParser]::Tokenize($Text, [ref]$null) |
24
+ Where-Object { $_.Type -in @("CommandArgument", "String", "Number") } |
25
+ ForEach-Object { $_.Content }
26
+ }
27
+
28
+ $projectRoot = if ($Root) { $Root } else { Get-DefaultRoot }
29
+ $projectRoot = (Resolve-Path -LiteralPath $projectRoot).Path
30
+ $takomi = Get-Tool "takomi"
31
+ $pi = Get-Tool "pi"
32
+
33
+ Write-Output "Takomi Pi dispatch"
34
+ Write-Output "Project: $projectRoot"
35
+ Write-Output "Mode: $(if ($Execute) { "execute" } else { "dry-run" })"
36
+ Write-Output ""
37
+
38
+ if (-not $takomi) { Write-Output "takomi CLI: missing" } else { Write-Output "takomi CLI: $($takomi.Source)" }
39
+ if (-not $pi) { Write-Output "pi CLI: missing" } else { Write-Output "pi CLI: $($pi.Source)" }
40
+ Write-Output ""
41
+
42
+ if ($Action -eq "status") {
43
+ Write-Output "Recommended diagnostics:"
44
+ Write-Output " .\takomi-detect.ps1 -Root `"$projectRoot`""
45
+ Write-Output " .\takomi-policy.ps1 -Root `"$projectRoot`""
46
+ Write-Output " takomi doctor"
47
+ exit 0
48
+ }
49
+
50
+ $command = $null
51
+ $commandArgs = @()
52
+
53
+ switch ($Action) {
54
+ "doctor" {
55
+ if (-not $takomi) { throw "takomi CLI is not available." }
56
+ $command = $takomi.Source
57
+ $commandArgs = @("doctor")
58
+ }
59
+ "launch" {
60
+ if (-not $takomi) { throw "takomi CLI is not available." }
61
+ $command = $takomi.Source
62
+ $commandArgs = @()
63
+ }
64
+ "takomi" {
65
+ if (-not $takomi) { throw "takomi CLI is not available." }
66
+ $command = $takomi.Source
67
+ $commandArgs = Split-ArgsLine $ArgsLine
68
+ }
69
+ "pi" {
70
+ if (-not $pi) { throw "pi CLI is not available." }
71
+ $command = $pi.Source
72
+ $commandArgs = Split-ArgsLine $ArgsLine
73
+ }
74
+ }
75
+
76
+ if (-not $command) { throw "No command resolved for action '$Action'." }
77
+
78
+ Write-Output "Resolved command:"
79
+ Write-Output " $command $($commandArgs -join ' ')"
80
+ Write-Output ""
81
+
82
+ if (-not $Execute) {
83
+ Write-Output "Dry run only. Re-run with -Execute to execute this command."
84
+ exit 0
85
+ }
86
+
87
+ Push-Location $projectRoot
88
+ try {
89
+ & $command @commandArgs
90
+ exit $LASTEXITCODE
91
+ } finally {
92
+ Pop-Location
93
+ }
@@ -0,0 +1,108 @@
1
+ param(
2
+ [string]$Root,
3
+ [switch]$Json
4
+ )
5
+
6
+ $ErrorActionPreference = "Stop"
7
+
8
+ function Get-DefaultRoot {
9
+ $pluginRoot = Split-Path -Parent $PSScriptRoot
10
+ $pluginsRoot = Split-Path -Parent $pluginRoot
11
+ return Split-Path -Parent $pluginsRoot
12
+ }
13
+
14
+ function Read-TextSafe([string]$PathValue) {
15
+ if (Test-Path -LiteralPath $PathValue -PathType Leaf) {
16
+ return Get-Content -Raw -LiteralPath $PathValue
17
+ }
18
+ return $null
19
+ }
20
+
21
+ function Read-JsonSafe([string]$PathValue) {
22
+ if (Test-Path -LiteralPath $PathValue -PathType Leaf) {
23
+ try { return Get-Content -Raw -LiteralPath $PathValue | ConvertFrom-Json } catch { return $null }
24
+ }
25
+ return $null
26
+ }
27
+
28
+ function Get-PolicyFiles([string]$Dir) {
29
+ if (-not (Test-Path -LiteralPath $Dir -PathType Container)) { return @() }
30
+ return Get-ChildItem -LiteralPath $Dir -File -ErrorAction SilentlyContinue |
31
+ Where-Object { $_.Extension -in @(".md", ".json", ".txt") } |
32
+ Sort-Object Name |
33
+ ForEach-Object {
34
+ [pscustomobject]@{
35
+ name = $_.Name
36
+ path = $_.FullName
37
+ preview = ((Get-Content -Raw -LiteralPath $_.FullName) -split "\r?\n" | Select-Object -First 8) -join "`n"
38
+ }
39
+ }
40
+ }
41
+
42
+ $projectRoot = if ($Root) { $Root } else { Get-DefaultRoot }
43
+ $projectRoot = (Resolve-Path -LiteralPath $projectRoot).Path
44
+ $homeDir = [Environment]::GetFolderPath("UserProfile")
45
+
46
+ $projectSettingsPath = Join-Path $projectRoot ".pi\settings.json"
47
+ $projectProfilePath = Join-Path $projectRoot ".pi\takomi-profile.json"
48
+ $projectRoutingPath = Join-Path $projectRoot ".pi\takomi\model-routing.md"
49
+ $projectPoliciesDir = Join-Path $projectRoot ".pi\takomi\policies"
50
+
51
+ $userRoutingPath = Join-Path $homeDir ".pi\agent\takomi\model-routing.md"
52
+ $userPoliciesDir = Join-Path $homeDir ".pi\agent\takomi\policies"
53
+
54
+ $result = [pscustomobject]@{
55
+ projectRoot = $projectRoot
56
+ project = [pscustomobject]@{
57
+ settingsPath = $projectSettingsPath
58
+ settings = Read-JsonSafe $projectSettingsPath
59
+ profilePath = $projectProfilePath
60
+ profile = Read-JsonSafe $projectProfilePath
61
+ routingPath = $projectRoutingPath
62
+ routing = Read-TextSafe $projectRoutingPath
63
+ policies = Get-PolicyFiles $projectPoliciesDir
64
+ }
65
+ user = [pscustomobject]@{
66
+ routingPath = $userRoutingPath
67
+ routing = Read-TextSafe $userRoutingPath
68
+ policies = Get-PolicyFiles $userPoliciesDir
69
+ }
70
+ }
71
+
72
+ if ($Json) {
73
+ $result | ConvertTo-Json -Depth 10
74
+ exit 0
75
+ }
76
+
77
+ Write-Output "Takomi policy context"
78
+ Write-Output "Project: $projectRoot"
79
+ Write-Output ""
80
+ Write-Output "Project settings: $projectSettingsPath"
81
+ if ($result.project.settings) { $result.project.settings | ConvertTo-Json -Depth 6 } else { Write-Output " missing or invalid" }
82
+ Write-Output ""
83
+ Write-Output "Project profile: $projectProfilePath"
84
+ if ($result.project.profile) { $result.project.profile | ConvertTo-Json -Depth 8 } else { Write-Output " missing or invalid" }
85
+ Write-Output ""
86
+ Write-Output "Project model routing: $projectRoutingPath"
87
+ if ($result.project.routing) { Write-Output $result.project.routing } else { Write-Output " missing" }
88
+ Write-Output ""
89
+ Write-Output "Project policy files:"
90
+ if ($result.project.policies.Count) {
91
+ foreach ($policy in $result.project.policies) {
92
+ Write-Output " - $($policy.name): $($policy.path)"
93
+ }
94
+ } else {
95
+ Write-Output " none"
96
+ }
97
+ Write-Output ""
98
+ Write-Output "User/global model routing: $userRoutingPath"
99
+ if ($result.user.routing) { Write-Output $result.user.routing } else { Write-Output " missing" }
100
+ Write-Output ""
101
+ Write-Output "User/global policy files:"
102
+ if ($result.user.policies.Count) {
103
+ foreach ($policy in $result.user.policies) {
104
+ Write-Output " - $($policy.name): $($policy.path)"
105
+ }
106
+ } else {
107
+ Write-Output " none"
108
+ }
@@ -0,0 +1,194 @@
1
+ ---
2
+ name: takomi-codex
3
+ description: Use Takomi lifecycle orchestration inside Codex with policy-aware runtime detection, markdown roadbooks, optional Pi/Takomi dispatch, and explicit-consent delegation.
4
+ ---
5
+
6
+ # Takomi Codex
7
+
8
+ Takomi Codex is the Codex-native adapter for the Takomi protocol. Use it when the user asks for Takomi, orchestration, roadbooks, Genesis/Design/Build lifecycle work, policy-aware execution, Pi/Takomi runtime inspection, or delegated task coordination.
9
+
10
+ ## Operating Principle
11
+
12
+ Choose the smallest execution mode that can do the work well, then delegate by default once Takomi decomposes the work:
13
+
14
+ 1. Direct Codex work for small, local, one-shot tasks.
15
+ 2. Planning mode for unclear or UI/UX-heavy work.
16
+ 3. Markdown roadbook orchestration for broad multi-step work.
17
+ 4. Delegation-first orchestration when Takomi creates subtasks, roadbook tasks, or an orchestration session.
18
+
19
+ Do not create a board, launch a harness, or spawn threads for trivial edits.
20
+
21
+ The main Codex agent remains the orchestrator for decomposed work. It owns context intake, task packets, board updates, synthesis, verification, and final user handoff. It should not act as the primary implementer by default after decomposition begins.
22
+
23
+ User override is explicit: if the user says "do it yourself", "no subagents", "no new threads", or equivalent, the main agent may execute directly while still keeping any existing roadbook current.
24
+
25
+ ## Required Context Pass
26
+
27
+ Before complex code or orchestration, inspect the project:
28
+
29
+ - `docs/features/`
30
+ - `docs/project_requirements.md`
31
+ - `docs/Project_Requirements.md`
32
+ - local `.pi/` if relevant
33
+ - Takomi feature docs related to the request
34
+
35
+ For major features, create or update a feature markdown file before implementation.
36
+
37
+ ## Runtime Detection
38
+
39
+ Use `scripts/takomi-detect.ps1` when runtime state affects the answer.
40
+
41
+ Detection priority:
42
+
43
+ 1. Project-local `.pi/`.
44
+ 2. User/global `~/.pi/agent/` and `~/.agents/skills/`.
45
+ 3. CLI availability for `takomi` and `pi`.
46
+ 4. Plugin-bundled guidance.
47
+
48
+ Global/user paths are read-only unless the user explicitly approves a write.
49
+
50
+ ## Policy Loading
51
+
52
+ Use `scripts/takomi-policy.ps1` when model, subagent, review, or lifecycle routing matters.
53
+
54
+ Respect project policy first:
55
+
56
+ - `.pi/settings.json`
57
+ - `.pi/takomi-profile.json`
58
+ - `.pi/takomi/model-routing.md`
59
+ - `.pi/takomi/policies/`
60
+
61
+ Avoid hard-coding personal model names as universal defaults. Prefer provider-qualified model IDs only when the active policy or runtime registry supports them.
62
+
63
+ ## Roadbook Orchestration
64
+
65
+ Use `scripts/takomi-board.ps1` for broad work that needs durable coordination.
66
+
67
+ Markdown roadbooks are the durable source of truth for orchestration state, even when Pi, subagents, multi-agent tools, explicitly requested Codex threads, or optional JSON tracking are used.
68
+
69
+ Roadbooks live at:
70
+
71
+ ```text
72
+ docs/tasks/orchestrator-sessions/<sessionId>/
73
+ ```
74
+
75
+ The markdown layer is primary:
76
+
77
+ - `master_plan.md`
78
+ - `pending/*.task.md`
79
+ - `in-progress/*.task.md`
80
+ - `completed/*.task.md`
81
+ - `blocked/*.task.md`
82
+ - `Orchestrator_Summary.md`
83
+
84
+ JSON tracking is optional and should not replace readable markdown.
85
+
86
+ ## Delegation-First Loop
87
+
88
+ When a request is broad enough to create subtasks, roadbook tasks, or an orchestration session:
89
+
90
+ 1. Create or update the markdown roadbook and task packets.
91
+ 2. Delegate implementation to an implementer subagent or child thread.
92
+ 3. Delegate review to a separate reviewer subagent or child thread.
93
+ 4. Synthesize results in the main thread.
94
+ 5. Update the roadbook, then accept the work or redispatch with a tighter packet.
95
+
96
+ In Pi, prefer `takomi_subagent` for implementer and reviewer runs. In Codex, prefer available multi-agent or subagent tools for delegated subtasks. If those tools are unavailable, create markdown task packets and execute directly as the fallback. Use user-owned Codex child threads only when the user explicitly asks for new threads, handoff threads, or parallel thread orchestration, or when the parent agent recommends that route and the user approves it.
97
+
98
+ ## Lifecycle Modes
99
+
100
+ ### Genesis
101
+
102
+ Use for project foundations, requirements, feature planning, and issue-style task breakdowns.
103
+
104
+ Expected artifacts:
105
+
106
+ - PRD or project requirements update
107
+ - feature docs
108
+ - task/issue docs
109
+ - acceptance criteria
110
+
111
+ ### Design
112
+
113
+ Use for UI/UX only: visual systems, screen structure, user journeys, interaction flows, mockups, accessibility expectations, and frontend handoff constraints.
114
+
115
+ Do not use Design for application architecture, data models, API/interface contracts, backend service boundaries, deployment strategy, or implementation task planning. Route that work to Genesis or Architect planning.
116
+
117
+ Expected artifacts:
118
+
119
+ - visual design notes or specs
120
+ - screen/component appearance plan
121
+ - interaction and responsive behavior
122
+ - accessibility and usability constraints
123
+
124
+ ### Build
125
+
126
+ Use for implementation after enough context exists.
127
+
128
+ Expected behavior:
129
+
130
+ - implement iteratively
131
+ - keep files focused
132
+ - update docs alongside code
133
+ - verify with available tests or scripts
134
+
135
+ ### Review
136
+
137
+ Use for bug finding, quality gates, security review, and completion audits.
138
+
139
+ Expected behavior:
140
+
141
+ - lead with findings
142
+ - verify artifacts before marking complete
143
+ - record unresolved risks
144
+
145
+ ## Pi/Takomi Bridge
146
+
147
+ Use `scripts/takomi-pi-dispatch.ps1` conservatively.
148
+
149
+ Default behavior is dry-run recommendation. Only run real Pi/Takomi commands when:
150
+
151
+ - the user explicitly asks for it, or
152
+ - an active policy calls for it and the action is safe, or
153
+ - the command is diagnostic/read-only.
154
+
155
+ Do not assume raw subagent tools are present. Prefer Takomi-facing surfaces when available.
156
+
157
+ When Pi orchestration is active, prefer `takomi_subagent` over direct implementation for decomposed work.
158
+
159
+ ## Other Harnesses
160
+
161
+ Use `scripts/takomi-harness.ps1` when a project policy or user request points to other Takomi-supported harnesses.
162
+
163
+ Default behavior is dry-run. Before running with `-Execute`:
164
+
165
+ - confirm the target harness or Takomi command
166
+ - understand whether it will write user/global files
167
+ - prefer `status` or `harnesses` before `sync`, `setup`, or `refresh`
168
+ - keep Codex as the parent coordinator unless the user explicitly hands off execution
169
+
170
+ ## Codex Delegation
171
+
172
+ When Takomi decomposition makes delegation appropriate:
173
+
174
+ 1. Search for available multi-agent or subagent tools with `tool_search` when delegation would materially help.
175
+ 2. Give each delegate a self-contained task packet path and definition of done.
176
+ 3. Keep the parent thread responsible for synthesis, verification, docs, and board updates.
177
+ 4. Do not delegate tasks that require global/user config writes unless the user approved that scope.
178
+ 5. Create or fork user-owned Codex threads only when the user explicitly asks for new threads, handoff threads, or parallel thread orchestration, or when the parent agent recommends that route and the user approves it.
179
+
180
+ If delegation tooling is unavailable, fall back to markdown task packets and direct Codex execution.
181
+
182
+ ## File Size Discipline
183
+
184
+ Keep plugin scripts and skill files modular. If a file approaches 200 lines, split responsibilities instead of growing one giant file.
185
+
186
+ ## Completion Rule
187
+
188
+ Before handoff:
189
+
190
+ - update the relevant feature doc
191
+ - update the roadbook if one exists
192
+ - run the plugin validator when plugin files changed
193
+ - run script smoke checks when scripts changed
194
+ - state what was verified and what remains unverified