@flowmind/cli 0.2.2 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,6 +21,15 @@ and trust the changed hooks. The hook records each agent turn under the CLI conf
21
21
  In a linked repository, the session-start hook tells the agent which project it works on. Once 20 or more minutes of
22
22
  finished agent turns are unstaged, each prompt also carries a reminder with the minutes and the
23
23
  staging command. A successful `agent stage` resets the count.
24
+
25
+ In a git repository without `.flowmind.json`, the session-start hook first reads `.flowmind.json` from the
26
+ local remote-tracking refs: the current branch's upstream, then `origin/HEAD`, `origin/main` and
27
+ `origin/master`. It does not fetch. If a remote ref links the repository, the agent learns the project and
28
+ is told to run `git pull` and never to create a new project. Otherwise the agent gets the steps to link
29
+ the repository: pull, find the existing project, create one only for a new product, link, and commit
30
+ `.flowmind.json`, or mark a third-party clone or scratch folder with `link --ignore`. Once 20 minutes of
31
+ agent turns are recorded in such a repository, one prompt per session repeats this as a short reminder.
32
+ Ignored repositories and folders outside git get no context and no reminder.
24
33
  Codex runs new hooks only after you trust them once in `/hooks`. `hooks status` shows both installs,
25
34
  and `hooks uninstall` removes only the Flowmind entries.
26
35
 
@@ -35,12 +44,28 @@ flowmind projects add "Bead Focus" --description "Focus timer for iOS" --json
35
44
  flowmind link "Bead Focus" # writes .flowmind.json at the repository root
36
45
  flowmind link <project-id> --dir ~/projects/bead-focus
37
46
  flowmind link # shows the current link
47
+ flowmind link --ignore --reason "Third-party clone"
48
+ flowmind link --scan ~/projects ~/code --depth 2
38
49
  ```
39
50
 
40
51
  A link names the project by id and keeps its name as a label. `link` accepts an id or an exact
41
52
  project name and checks it against the projects visible to agents. Commit `.flowmind.json` to share
42
53
  the link with other machines and agents.
43
54
 
55
+ One product is one project on every machine. `projects add` refuses a name that an existing project
56
+ already has (trimmed, ignoring case), names that project and its id, and suggests `flowmind link <id>`.
57
+ It creates nothing in that case. `--allow-duplicate` creates the second project anyway.
58
+
59
+ `link --ignore` writes `{"ignore": true, "reason": "..."}` as `.flowmind.json` for a third-party clone or
60
+ a scratch folder. `link` then prints `Ignored for Flowmind`, the hooks stay silent there, and
61
+ `agent stage` fails unless you pass `--project`. Commit the marker so other machines skip it too.
62
+
63
+ `link --scan <dir...>` finds git repositories in each directory and up to `--depth` folder levels below
64
+ it (default 2). It skips hidden folders and `node_modules`, and does not search inside a repository.
65
+ Each repository gets a status: `linked`, `ignored`, `remote-linked` (a local remote-tracking ref has the
66
+ link; run `git pull`) or `unlinked`, with the project and the origin URL without credentials.
67
+ `--json` prints `{ "repositories": [...] }`. The scan exits 0 and does not use the network.
68
+
44
69
  Log completed work by project name and duration:
45
70
 
46
71
  ```sh
@@ -71,9 +96,13 @@ flowmind agent stage --intention "Finish the reader" --outcome "Shipped the read
71
96
  ```
72
97
 
73
98
  The CLI reads the project from `.flowmind.json` and the session from `CODEX_THREAD_ID` or the one
74
- session with a turn in progress in the repository. The duration is the recorded agent turn time
75
- since the session's last staged proof; idle time between turns does not count. Fewer than one
76
- recorded minute is an error. The source kind is `codex` or `claude_code` from the recording host.
99
+ session with a turn in progress in the repository. The duration is the main agent's recorded turn
100
+ time since the session's last staged proof, in whole minutes; the remaining seconds carry over to
101
+ the next proof. Idle time between turns does not count, and neither does sleep: the hooks read the
102
+ awake clock that Codex uses for "Worked for". Subagent prompts never start a turn, because the main
103
+ agent's turn already contains their work. When nothing new is recorded, or when a Codex subagent
104
+ calls the command, it stages nothing, prints `"staged": false` with a `reason` and a `message`,
105
+ and exits 0. The source kind is `codex` or `claude_code` from the recording host.
77
106
  `--dry-run` prints the request and its retry key without staging anything.
78
107
 
79
108
  Without hooks, pass observed values:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: flowmind
3
- description: "Set up Flowmind for a builder's coding agents and log agent work to it with the flowmind CLI. Use when the user asks to set up, connect, or onboard Flowmind; to create or link Flowmind projects; to log or stage work in Flowmind; to check Flowmind progress; or when you finish material work in a repository that has a .flowmind.json file. Skip generic time tracking that does not involve Flowmind."
3
+ description: "Set up Flowmind for a builder's coding agents and log agent work to it with the flowmind CLI. Use when the user asks to set up, connect, or onboard Flowmind; to create or link Flowmind projects; to log or stage work in Flowmind; to check Flowmind progress; when you finish material work in a repository that has a .flowmind.json file; when you start or scaffold a new project or repository; or when you work in a repository that Flowmind reports as not linked. Skip generic time tracking that does not involve Flowmind."
4
4
  homepage: https://www.flowmind.pro/
5
5
  metadata: { "openclaw": { "emoji": "⏱️" } }
6
6
  ---
@@ -13,29 +13,50 @@ Flowmind records what a builder ships, including work their agents do. Agents us
13
13
 
14
14
  Use this when the user says "set up Flowmind", "connect my projects to Flowmind", or similar.
15
15
 
16
- 1. Check the CLI with `flowmind --version`. If it is missing or older than 0.2.0, run `npm install -g @flowmind/cli`.
16
+ 1. Check the CLI with `flowmind --version`. If it is missing or older than 0.3.0, run `npm install -g @flowmind/cli`.
17
17
  2. Check sign-in with `flowmind auth status --json`. If `authenticated` is false, run `flowmind auth login --no-browser`, give the user the printed URL, and keep the command running while it waits (up to 5 minutes). The user approves in the browser.
18
18
  3. Install the skill and session hooks with `flowmind hooks install`. Tell the user that Codex runs new hooks only after they trust them once in `/hooks`. Claude Code runs them at its next session.
19
19
  4. Inventory the user's local work:
20
- - Find git repositories in the folders the user works in (for example `~/projects`, `~/code`, `~/src`, and the workspaces your host lists). Read each README or package manifest only far enough to name and describe the project.
20
+ - Find git repositories and their link status with `flowmind link --scan <dir...> --json` over the folders the user works in (for example `~/projects`, `~/code`, `~/src`, and the workspaces your host lists). Read each README or package manifest only far enough to name and describe the project.
21
21
  - Read existing Flowmind projects with `flowmind projects --json`.
22
- - Read existing links with `flowmind link --dir <repo> --json`.
23
- 5. Propose a table: repository path, Flowmind project name, one-line description, and action (create, link to an existing project, or skip). Put repositories of one product under one project. Ask the user to approve or edit the list. Create nothing before they approve.
22
+ - A `remote-linked` repository needs only `git pull`.
23
+ 5. Propose a table: repository path, Flowmind project name, one-line description, and action (create, link to an existing project, or ignore). Put repositories of one product under one project. Ask the user to approve or edit the list. Create nothing before they approve.
24
24
  6. After approval, for each row:
25
25
  - Create: `flowmind projects add "<name>" --description "<one line>" --json`. The new id is `project.id`.
26
26
  - Link: `flowmind link <project-id> --dir <repo> --json`. This writes `.flowmind.json` at the repository root.
27
+ - Ignore: `flowmind link --ignore --dir <repo>`.
27
28
  - Ask whether to commit `.flowmind.json`. A committed link reaches the user's other machines and agents.
28
29
  7. Report what you created and linked, and explain how agent work gets logged from now on.
29
30
 
31
+ ## New projects and unlinked repositories
32
+
33
+ Use this when you start or scaffold a new project or repository, or when a session starts in a repository that Flowmind reports as not linked.
34
+
35
+ One product is one Flowmind project on every machine. The same repository on another machine already shares its link through the committed `.flowmind.json`. Never create a duplicate project.
36
+
37
+ 1. Run `git pull` first. Another machine may have linked the repository already. If Flowmind says the remote links it, the pull is all you need.
38
+ 2. Look for the existing project with `flowmind projects --json`. Match by product, repository, and name.
39
+ 3. Create a project with `flowmind projects add "<name>" --description "<one line>" --json` only for a new product. If it refuses because the name exists, link to that project instead.
40
+ 4. Run `flowmind link <project-id>` and commit `.flowmind.json`.
41
+ 5. For a third-party clone or a scratch folder, run `flowmind link --ignore` instead, and commit the marker.
42
+
43
+ Ask the user once when you are unsure which project a repository belongs to, or whether it counts at all. Do this before you finish the task.
44
+
45
+ To find gaps across the user's folders, run `flowmind link --scan <dir...>`. It lists each repository as `linked`, `ignored`, `remote-linked`, or `unlinked`.
46
+
30
47
  ## Log agent work
31
48
 
32
- In a linked repository, the session hooks record how long each agent turn runs. When you finish a material unit of work, such as a feature, fix, investigation, or document, stage it. Do not stage every turn.
49
+ In a linked repository, the session hooks record how long the main agent's turns run. When you finish a material unit of work, such as a feature, fix, investigation, or document, stage it before you start the next one. Do not stage every turn.
33
50
 
34
51
  ```bash
35
52
  flowmind agent stage --intention "<what you set out to do>" --outcome "<what changed or shipped>" --artifact-url <commit, PR, or document URL> --json
36
53
  ```
37
54
 
38
- - The CLI reads the project from `.flowmind.json` and the time from the session record. A second stage in the same session covers only the time after the first.
55
+ - The CLI reads the project from `.flowmind.json` and the time from the session record. The time is the main agent's turn time on the awake clock that Codex uses for "Worked for", so sleep does not count. It includes the time that subagents work during the turn.
56
+ - A stage covers the whole minutes since the session's last proof. The remaining seconds carry over to the next proof.
57
+ - When several units of work finish together, stage them as one proof that names them all. A second stage right after the first has no new time.
58
+ - Subagents do not stage. In a Codex subagent, `flowmind agent stage` stages nothing and tells the subagent to report its outcome to the main agent.
59
+ - `"staged": false` in the JSON output means that nothing was staged, and it is not an error. `reason` is `no-new-time` when the last proof (`lastProposalId`) already holds the session's time, or `subagent`. Tell the user which proof covers the work.
39
60
  - After 20 minutes of unstaged agent time, each prompt in a linked repository carries a reminder with the unstaged minutes. Stage when the current unit of work is complete; a stage with explicit times also resets the count.
40
61
  - Add `--dry-run` to preview the project and minutes without staging.
41
62
  - Pass `--project`, `--minutes`, and `--started-at` only when no session record exists. Use observed times only. Never estimate time from tokens or tool calls.
@@ -68,3 +89,5 @@ Ask only for missing fields. A natural-language entry (`flowmind log "2h on the
68
89
  - "No recorded agent time": the hooks are missing or not trusted, or the session started before installation. Stage with observed `--minutes` and `--started-at`, or stage in the next session.
69
90
  - "Several agent sessions have a turn in progress": pass `--session-id`.
70
91
  - "No project given": run `flowmind link <project>` in the repository, or pass `--project`.
92
+ - "This repository is ignored for Flowmind": the repository has an ignore marker. Pass `--project` only if the user wants this work staged.
93
+ - "A project named ... already exists": link to that project with `flowmind link <id>`. Use `--allow-duplicate` only when the user asks for a second project with the same name.