Skip to content

Commit 9790a40

Browse files
committed
feat(flow): add codex control-plane workflows
Add centralized Flow config/extensions, bounded project-ai and ops visibility, PR/session-doc packets, and sturdier JJ/sync workflow helpers. Keep the public repo clean by stripping Prom-specific staging leaks before commit.
1 parent 6a108e9 commit 9790a40

37 files changed

Lines changed: 16700 additions & 703 deletions

docs/codex-fork-tasks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ Creates or updates a review branch from the current task worktree tip.
9797

9898
Default mapping:
9999

100-
- `codex/workspace-awareness` -> `review/nikiv-workspace-awareness`
100+
- `codex/workspace-awareness` -> `review/workspace-awareness`
101101

102102
Examples:
103103

104104
```bash
105105
f codex-fork-promote
106106
f codex-fork-promote codex/workspace-awareness --push
107-
f codex-fork-promote ~/.worktrees/codex/codex-workspace-awareness --review-branch review/nikiv-codex-workspace-awareness
107+
f codex-fork-promote ~/.worktrees/codex/codex-workspace-awareness --review-branch review/workspace-awareness
108108
```
109109

110110
## State File

docs/commands/ai.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ f ai cursor list
2121
f codex resolve "latest"
2222
f codex resolve "https://linear.app/.../project/.../overview" --json
2323
f codex open "continue the deploy work"
24+
f codex agent list
25+
f codex agent show commit
2426
f ai claude resume <session-id-or-name>
2527
f ai codex resume <session-id-or-name>
2628
f ai codex resume --path ~/work/example-project
@@ -132,6 +134,7 @@ You can teach `f codex open` and `f codex resolve` to unroll repo-specific refer
132134
auto_resolve_references = true
133135
prompt_context_budget_chars = 900
134136
max_resolved_references = 1
137+
sync_workflow_command = "./scripts/sync-safe"
135138

136139
[[codex.reference_resolver]]
137140
name = "linear"
@@ -148,6 +151,7 @@ Notes:
148151
- resolver output is compacted before prompt injection
149152
- `prompt_context_budget_chars` hard-caps injected context before your request is appended
150153
- `max_resolved_references` prevents broad unrolling from bloating one turn
154+
- `sync_workflow_command` lets plain `sync branch` route into a repo-specific safe sync command instead of improvised Git/JJ steps
151155

152156
### Optional runtime skill transport
153157

@@ -170,6 +174,26 @@ runtime_skills = true
170174
codex_bin = "~/code/flow/scripts/codex-flow-wrapper"
171175
```
172176

177+
For the `~/code/flow` repo specifically, the intended in-repo shape is:
178+
179+
```toml
180+
[options]
181+
codex_bin = "~/code/flow/scripts/codex-flow-wrapper"
182+
183+
[codex]
184+
runtime_skills = true
185+
auto_resolve_references = true
186+
prompt_context_budget_chars = 1200
187+
max_resolved_references = 2
188+
189+
[[codex.skill_source]]
190+
name = "run-control-plane"
191+
path = "~/run"
192+
enabled = true
193+
```
194+
195+
That keeps a fresh checkout Codex-first even before machine-local setup is remembered.
196+
173197
Current first-slice behavior:
174198

175199
- `f codex open "write plan"` can attach a tiny plan-writing runtime skill
@@ -210,6 +234,41 @@ cat <<'EOF' | f codex runtime write-plan --title "Example Plan"
210234
EOF
211235
```
212236

237+
By default this writes to today's `~/plan/<day-of-month>/` bucket, for example
238+
`~/plan/23/` on the 23rd day of the month.
239+
240+
### Run-owned agent bridge
241+
242+
Flow can execute run-owned Codex agents directly without copying their specs or
243+
prompts into `~/code/flow`.
244+
245+
Useful commands:
246+
247+
```bash
248+
f codex agent list
249+
f codex agent list --json
250+
f codex agent show commit
251+
f codex agent run planner --path ~/code/flow "make a 3 phase rollout plan"
252+
f codex agent run commit --path ~/repos/openai/codex "review the current diff and draft a safe commit"
253+
f codex agent run planner --json --path ~/code/flow "reply with exactly: ok"
254+
```
255+
256+
Behavior:
257+
258+
- Flow bridges into `~/run/scripts/agent-router.sh`
259+
- the run-owned agent still executes through its own spec/runtime path in `~/run`
260+
- `--path` controls the repo/worktree cwd used for the agent run
261+
- `run` returns the agent's final output plus any durable artifact/trace paths
262+
- `f codex doctor --path <repo>` reports whether the run-agent bridge is ready
263+
264+
Repo-local readiness check:
265+
266+
```bash
267+
f codex doctor --path ~/code/flow --assert-runtime --assert-schedule
268+
f codex skill-source list --path ~/code/flow
269+
f codex agent list
270+
```
271+
213272
### Skill eval and background refresh
214273

215274
Flow can learn which runtime skills are actually worth injecting from local
@@ -229,8 +288,12 @@ f codex telemetry flush --limit 200
229288
f codex trace status
230289
f codex trace current-session --json
231290
f codex trace inspect <trace-id> --json
291+
f codex project-ai show --path ~/work/example-project --json
292+
f codex project-ai recent --limit 12 --json
232293
f codex skill-source list --path ~/work/example-project
233294
f codex skill-source sync --path ~/work/example-project --skill find-skills
295+
f codex agent list
296+
f codex agent run planner --path ~/work/example-project "summarize the next rollout slice"
234297
```
235298

236299
The Codex memory mirror:
@@ -243,6 +306,13 @@ The Codex memory mirror:
243306
- adds tiny symbol snippets for the top code hits, so coding prompts can carry actual struct/function shape without inlining whole files
244307
- biases retrieval by intent: implementation/file-edit prompts prefer symbols, snippets, and `src/...` paths; summary/docs prompts prefer doc headings and docs paths
245308
- stays best-effort so failed memory writes do not block normal Codex coding turns
309+
310+
The project-ai manifest:
311+
312+
- gives `codexd` a bounded metadata view of repo-local `.ai/` scaffolding
313+
- records counts and latest paths for skills, docs, reviews, tasks, and todos
314+
- keeps default context fill minimal by exposing only compact hints, not raw content
315+
- tracks query counts and recent repo usage so you can see whether the feature is actually being used
246316
- is refreshed again by `f codex skill-eval cron`, so the mirror heals even if a hot-path write is skipped
247317
- is queried automatically for explicit repo references during `f codex open` / `f codex resolve`
248318

docs/commands/config.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# f config
2+
3+
Compile the personal Flow root config and generated compatibility outputs.
4+
5+
Source of truth:
6+
7+
- `~/.flow/config.ts`
8+
9+
Generated outputs:
10+
11+
- `~/.config/flow/generated/config.snapshot.json`
12+
- `~/.config/flow/generated/flow/config.ts`
13+
- `~/.config/flow/generated/lin/config.ts`
14+
- `~/.config/flow/generated/lin/intents.json`
15+
- `~/.config/flow/generated/lin/mac.toml`
16+
- `~/.config/flow/generated/ai/config.json`
17+
- `~/.config/flow/generated/hive/config.json`
18+
19+
If `~/.flow/config.ts` does not exist yet, Flow currently falls back to:
20+
21+
- `~/config/i/lin/config.ts`
22+
23+
and generates a starter `~/.flow/config.ts` migration file on apply.
24+
25+
## Commands
26+
27+
### f config doctor
28+
29+
Shows whether the root config exists, whether a TypeScript runner is available,
30+
whether a generated snapshot already exists, and what extension directories are discoverable.
31+
32+
```bash
33+
f config doctor
34+
f config doctor --json
35+
```
36+
37+
### f config build
38+
39+
Loads the root config plus named extensions, computes the merged effective config,
40+
and writes generated artifacts under `~/.config/flow/generated/`.
41+
42+
This does not overwrite consumer config locations.
43+
44+
```bash
45+
f config build
46+
f config build --json
47+
```
48+
49+
### f config apply
50+
51+
Builds the snapshot and then applies the generated compatibility files into their
52+
consumer locations. This is the cutover step that keeps existing tools working while
53+
moving authoring into `~/.flow/config.ts`.
54+
55+
```bash
56+
f config apply
57+
f config apply --json
58+
```
59+
60+
### f config eval
61+
62+
Prints the currently effective merged config view. If no snapshot exists yet, Flow
63+
builds one first.
64+
65+
```bash
66+
f config eval
67+
f config eval --json
68+
```
69+
70+
## Root Config Shape
71+
72+
The first supported root-config shape is:
73+
74+
```ts
75+
export default {
76+
flow: { ... },
77+
lin: { ... },
78+
ai: { ... },
79+
hive: { ... },
80+
zerg: { ... },
81+
extensions: ["lin-compat"],
82+
}
83+
```
84+
85+
Filesystem extensions can live under:
86+
87+
- `~/.flow/extensions/<name>/extension.ts`
88+
- `~/.flow/extensions/<name>/config.ts`
89+
90+
Each extension can contribute partial config fragments plus optional generated files.
91+
92+
## Notes
93+
94+
- Flow currently ships one built-in extension name: `lin-compat`
95+
- explicit extensions must exist or `f config build` fails
96+
- generated outputs are written atomically

docs/commands/docs.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,42 @@ Lists `.ai/docs` files for the current project.
7070

7171
Shows recent commits and `.ai/docs` file modification times.
7272

73+
It now also shows:
74+
75+
- recent `.ai/docs/session-changes/...` packets generated from completed Flow-managed Codex sessions
76+
- doc-review queue state counts for the current project
77+
78+
### f docs review-pending
79+
80+
Runs the bounded daemon-style review pass over pending session-doc packets and records
81+
promotion decisions into queue state plus each packet's `promotion.json`.
82+
83+
Options:
84+
85+
- `-n, --limit <N>`: Maximum number of pending entries to review (default: `25`).
86+
87+
### f docs promote-session
88+
89+
Previews or applies promotion for a daemon-captured session-doc packet.
90+
91+
By default this is a dry run. It prints the chosen target under `.ai/docs/` and the
92+
promoted markdown note.
93+
94+
Options:
95+
96+
- `<SESSION>`: Session id, session id prefix, or session key like `019d035d-...` or `019d035d-1773776290`
97+
- `--apply`: Write the promoted note immediately
98+
99+
### f docs commit-pending
100+
101+
Commits promoted session-doc notes when the git diff is isolated to doc-only files.
102+
103+
This command refuses to commit if the worktree contains unrelated changes.
104+
105+
Options:
106+
107+
- `--dry-run`: Show the candidate files and commit message without staging or committing
108+
73109
### f docs edit
74110

75111
Opens a `.ai/docs` file in `$EDITOR`.

docs/commands/ext.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# f ext
2+
3+
Manage Flow config extensions under `~/.flow/extensions`.
4+
5+
This is the extension/operator surface for the centralized Flow config system:
6+
7+
- root config: `~/.flow/config.ts`
8+
- runtime helper: `~/.flow/runtime/flow-config.ts`
9+
- extension root: `~/.flow/extensions/<name>/`
10+
11+
Extensions are loaded by `f config build` / `f config apply` when their names
12+
appear in `extensions: [...]` inside `~/.flow/config.ts`.
13+
14+
For backwards compatibility, `f ext <path>` still supports the older external
15+
directory import workflow into `<project>/ext/<name>`.
16+
17+
## Commands
18+
19+
### f ext list
20+
21+
List built-in and filesystem extensions and whether they are enabled.
22+
23+
```bash
24+
f ext list
25+
f ext list --json
26+
```
27+
28+
### f ext doctor
29+
30+
Show root-config wiring for extensions:
31+
32+
- `~/.flow/config.ts`
33+
- `~/.flow/extensions`
34+
- `~/.flow/runtime/flow-config.ts`
35+
36+
and the currently discoverable extensions.
37+
38+
```bash
39+
f ext doctor
40+
f ext doctor --json
41+
```
42+
43+
### f ext init
44+
45+
Create a new extension scaffold under `~/.flow/extensions/<name>/`.
46+
47+
Generated files:
48+
49+
- `extension.ts`
50+
- `README.md`
51+
52+
The scaffold imports:
53+
54+
- `defineFlowExtension` from `~/.flow/runtime/flow-config.ts`
55+
56+
```bash
57+
f ext init my-extension
58+
f ext init my-extension --force
59+
```
60+
61+
### f ext enable
62+
63+
Enable an extension by name in `~/.flow/config.ts`.
64+
65+
```bash
66+
f ext enable my-extension
67+
```
68+
69+
### f ext disable
70+
71+
Disable an extension by name in `~/.flow/config.ts`.
72+
73+
```bash
74+
f ext disable my-extension
75+
```
76+
77+
### f ext import
78+
79+
Explicit legacy import form. Copies an external directory into `<project>/ext/`
80+
and adds `ext/` to `.gitignore`.
81+
82+
```bash
83+
f ext import ~/some/external/repo
84+
```
85+
86+
Bare path form is still accepted:
87+
88+
```bash
89+
f ext ~/some/external/repo
90+
```
91+
92+
## Extension Shape
93+
94+
An extension file can export:
95+
96+
```ts
97+
import { defineFlowExtension } from "../../runtime/flow-config"
98+
99+
export default defineFlowExtension({
100+
name: "my-extension",
101+
flow: { ... },
102+
lin: { ... },
103+
ai: { ... },
104+
hive: { ... },
105+
zerg: { ... },
106+
generatedFiles: [
107+
{
108+
path: "~/.some/target/file.json",
109+
content: "{...}",
110+
},
111+
],
112+
doctor: ["human-readable check or note"],
113+
})
114+
```
115+
116+
## Notes
117+
118+
- built-in extension currently supported: `lin-compat`
119+
- `f ext enable` rewrites `~/.flow/config.ts`
120+
- `f ext init` also ensures the runtime helper exists
121+
- generated file path collisions fail the build

0 commit comments

Comments
 (0)