@vortex-os/base 0.5.0 → 0.7.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.
package/README.md CHANGED
@@ -14,18 +14,26 @@ Base entry point for **VortEX** — a Multi-Agent Personal AI Work OS framework.
14
14
 
15
15
  ## Install
16
16
 
17
+ Install the framework, plus the optional `@vortex-os/memory-extended` add-on for semantic recall (drop it if you don't want search):
18
+
17
19
  ```bash
18
- npm install @vortex-os/base
20
+ npm install @vortex-os/base @vortex-os/memory-extended
19
21
  ```
20
22
 
21
- ## Quick start — one install, then `init`
23
+ > **On Windows PowerShell?** If `npm` fails with a script-execution / `UnauthorizedAccess` error, that's PowerShell's default policy blocking npm's wrapper script not a VortEX problem (it blocks *every* npm command). Fix it one of these ways: run `npm.cmd install …` instead of `npm install …`, or use `cmd.exe`, or enable scripts once with `Set-ExecutionPolicy -Scope CurrentUser RemoteSigned -Force` and retry.
24
+
25
+ ## Quick start
26
+
27
+ `@vortex-os/base` ships a `vortex` CLI. Two ways to a working instance:
28
+
29
+ **Easiest — let your agent do it.** In a new folder, open your coding agent (Claude Code, Codex, …) and tell it — **keep the literal `vortex init`, don't translate or paraphrase it**: *"install `@vortex-os/base` and `@vortex-os/memory-extended`, then run `vortex init`."* (Before the rule files exist the agent has no VortEX context, so a paraphrase like "initialize vortex" can be misread as a generic project setup; the exact `vortex init` avoids that.) The agent installs the packages and runs `init` (which asks for your name and role; what you're working on is optional). **Then restart the agent in that folder** so it loads the freshly created rule files (`CLAUDE.md`, `AGENTS.md`, …) and session hooks — agents read those only at startup. Bonus: the agent runs npm in its own shell, so the Windows PowerShell issue above never comes up.
22
30
 
23
- `@vortex-os/base` ships a `vortex` CLI, so a working instance is three steps:
31
+ **Manual three steps:**
24
32
 
25
33
  ```bash
26
- npm install @vortex-os/base # install the framework into a new folder
27
- npx vortex init # scaffold the instance (asks for name / role / task)
28
- # then open your agent (e.g. `claude`) in that folder
34
+ npm install @vortex-os/base @vortex-os/memory-extended # framework + semantic-recall add-on
35
+ npx vortex init # scaffold the instance (asks name + role; task optional)
36
+ # then open your agent (e.g. `claude`) in that folder — a fresh start loads the rules init just created
29
37
  ```
30
38
 
31
39
  `npx vortex init` is non-destructive and creates, in the current folder:
package/dist/index.d.ts CHANGED
@@ -303,12 +303,20 @@ interface CommandArg {
303
303
  * - `rest` — the unparsed trailing portion of the input (everything after
304
304
  * the command name), provided as-is for commands that prefer to handle
305
305
  * their own parsing.
306
+ * - `argv` — pre-split argument tokens (everything after the command name),
307
+ * present only when the caller already holds the shell-split argv (e.g. the
308
+ * `vortex` CLI). A command that does its own quote-aware tokenization should
309
+ * prefer this over re-parsing `rest`: it avoids the lossy
310
+ * string-join-then-re-tokenize round-trip, so quotes/spaces/empty values in a
311
+ * token can never shift the boundaries of later tokens. Absent for the
312
+ * typed-slash path, where the command falls back to tokenizing `rest`.
306
313
  * - `context` — resolved repository paths from `@vortex-os/core.makeContext`.
307
314
  */
308
315
  interface CommandInput {
309
316
  readonly raw: string;
310
317
  readonly args: Readonly<Record<string, string>>;
311
318
  readonly rest: string;
319
+ readonly argv?: readonly string[];
312
320
  readonly context: ModuleContext;
313
321
  }
314
322
  /**
@@ -360,6 +368,18 @@ declare class CommandNotFoundError extends Error {
360
368
  * Returns whatever the command's handler returns (awaited if it is async).
361
369
  */
362
370
  declare function runSlash(input: string, { registry, context }: RunOptions): Promise<unknown>;
371
+ /**
372
+ * Dispatch a command by name with pre-split argument tokens, skipping the
373
+ * whitespace split `runSlash` does on a raw string. Use this when the caller
374
+ * already holds clean tokens (e.g. the shell-split `vortex` CLI argv): the
375
+ * tokens reach the handler verbatim via `CommandInput.argv`, so quotes, spaces,
376
+ * or empty values inside a token can never shift the boundaries of later tokens
377
+ * (the lossy hazard of joining argv into a string and re-tokenizing it).
378
+ *
379
+ * `argv` is the tokens AFTER the command name. `rest`/`args` are still derived
380
+ * for handlers that read them, but a quote-aware command should prefer `argv`.
381
+ */
382
+ declare function runSlashArgv(name: string, argv: readonly string[], { registry, context }: RunOptions): Promise<unknown>;
363
383
 
364
384
  //# sourceMappingURL=index.d.ts.map
365
385
 
@@ -372,8 +392,9 @@ type index_d$c_CommandRegistry = CommandRegistry;
372
392
  declare const index_d$c_CommandRegistry: typeof CommandRegistry;
373
393
  type index_d$c_RunOptions = RunOptions;
374
394
  declare const index_d$c_runSlash: typeof runSlash;
395
+ declare const index_d$c_runSlashArgv: typeof runSlashArgv;
375
396
  declare namespace index_d$c {
376
- export { type index_d$c_Command as Command, type index_d$c_CommandArg as CommandArg, type index_d$c_CommandInput as CommandInput, index_d$c_CommandNotFoundError as CommandNotFoundError, index_d$c_CommandRegistry as CommandRegistry, type index_d$c_RunOptions as RunOptions, index_d$c_runSlash as runSlash };
397
+ export { type index_d$c_Command as Command, type index_d$c_CommandArg as CommandArg, type index_d$c_CommandInput as CommandInput, index_d$c_CommandNotFoundError as CommandNotFoundError, index_d$c_CommandRegistry as CommandRegistry, type index_d$c_RunOptions as RunOptions, index_d$c_runSlash as runSlash, index_d$c_runSlashArgv as runSlashArgv };
377
398
  }
378
399
 
379
400
  /**
@@ -2583,14 +2604,196 @@ interface CliIo {
2583
2604
  * `curate` is intentionally NOT wired here — it is agent-mediated.
2584
2605
  */
2585
2606
  declare function buildRegistry(): Promise<CommandRegistry>;
2586
- /** Resolve the repo root the same way every entry point should: env override, else cwd. */
2607
+ /**
2608
+ * Resolve the repo root every entry point should use. Precedence:
2609
+ * 1. `VORTEX_REPO_ROOT` env — explicit override always wins.
2610
+ * 2. cwd, if cwd is itself an initialized instance — running inside an instance
2611
+ * uses that instance (so multiple instances on one machine still work).
2612
+ * 3. the global pointer (`~/.claude/vortex-global.json`), set by
2613
+ * `vortex global-setup` — so commands run from any other folder record to
2614
+ * the one central instance.
2615
+ * 4. cwd — the original fallback.
2616
+ * Until global-setup runs (no pointer), this is identical to the old behavior:
2617
+ * env override, else cwd.
2618
+ */
2587
2619
  declare function resolveRepoRoot(): string;
2620
+ /**
2621
+ * Reassemble shell-split argv into the `/`-command string `runSlash` expects,
2622
+ * for every command EXCEPT `/vortex`. Whitespace-containing values are wrapped by
2623
+ * `requote` so they stay visible as a quoted span, and empty tokens are dropped.
2624
+ * `runSlash` then splits this on whitespace only (it is NOT quote-aware), so this
2625
+ * path preserves the long-standing behavior of those commands rather than
2626
+ * guaranteeing perfect token reunification.
2627
+ *
2628
+ * `/vortex` deliberately bypasses this: the CLI threads its tokens straight to
2629
+ * the handler (`runSlashArgv` in runVortexCli), which is what fixes the
2630
+ * quoted/empty-value boundary bug — no lossy join-then-resplit round-trip.
2631
+ */
2632
+ declare function argvToSlash(argv: readonly string[]): string;
2588
2633
  /**
2589
2634
  * Run the `vortex` CLI for the given argv (already sliced past `node script`).
2590
2635
  * Returns the process exit code (0 success, 1 on error) instead of calling
2591
2636
  * `process.exit`, so callers/tests stay in control.
2592
2637
  */
2593
2638
  declare function runVortexCli(argv: readonly string[], io?: CliIo): Promise<number>;
2639
+ /**
2640
+ * Detect an interrupted git operation — a near-certain crashed-session signal:
2641
+ * a merge / rebase / cherry-pick / revert / bisect left mid-flight, or a stray
2642
+ * index lock. Uses `git rev-parse --git-path` so the marker resolves correctly
2643
+ * even when `.git` is a FILE (a linked worktree or submodule), not a directory.
2644
+ * Returns the FIRST matching marker name, or null when the tree is clean / not a
2645
+ * git repo. Exported for tests. (Tier-1 carryover; decision-log 2026-06-04.)
2646
+ */
2647
+ declare function detectInterruptedGitOp(repoRoot: string): string | null;
2648
+ /**
2649
+ * Assemble the Tier-1 carryover signal for the session-start report. The
2650
+ * interrupted-op check and the uncommitted count are computed INDEPENDENTLY: a
2651
+ * held/stale `index.lock` can make `git status` fail, and that must NOT suppress
2652
+ * the interrupted-op signal — the very case we most want to surface. Returns
2653
+ * null when there is nothing to report (clean tree / not a git repo). Exported
2654
+ * for tests. (decision-log 2026-06-04-session-recovery-two-tier.)
2655
+ */
2656
+ declare function collectCarryover(repoRoot: string): {
2657
+ uncommitted: number;
2658
+ interrupted: string | null;
2659
+ } | null;
2660
+
2661
+ /**
2662
+ * Hook wiring for `/vortex init`: make sure the instance's
2663
+ * `.claude/settings.json` registers the VortEX SessionStart / SessionEnd hooks,
2664
+ * so the boot report + worklog-net fire automatically without the user knowing
2665
+ * any command. NON-DESTRUCTIVE — like the MCP install merge, this preserves
2666
+ * every other hook and top-level field and only adds our two entries if absent.
2667
+ *
2668
+ * Pure functions here (parse / merge / detect); the command does the actual
2669
+ * file read/write around them. Keeping them pure makes the merge unit-testable
2670
+ * and the "writes only what's missing" guarantee verifiable.
2671
+ */
2672
+ declare const SESSION_START_COMMAND = "npx --no-install -p @vortex-os/base vortex session-start || exit 0";
2673
+ declare const SESSION_END_COMMAND = "npx --no-install -p @vortex-os/base vortex session-end || exit 0";
2674
+ interface HookCommand {
2675
+ readonly type: "command";
2676
+ readonly command: string;
2677
+ }
2678
+ interface HookGroup {
2679
+ readonly hooks: readonly HookCommand[];
2680
+ readonly matcher?: string;
2681
+ }
2682
+ interface ClaudeSettings {
2683
+ hooks?: {
2684
+ SessionStart?: HookGroup[];
2685
+ SessionEnd?: HookGroup[];
2686
+ [event: string]: HookGroup[] | undefined;
2687
+ };
2688
+ [key: string]: unknown;
2689
+ }
2690
+ interface EnsureHooksResult {
2691
+ readonly settings: ClaudeSettings;
2692
+ /**
2693
+ * Hook events that CHANGED — a VortEX entry was added, or a legacy one was
2694
+ * migrated/de-duplicated in place (empty when nothing changed). Callers should
2695
+ * key "did we need to write?" off `alreadyWired`, not the name "added".
2696
+ */
2697
+ readonly added: readonly ("SessionStart" | "SessionEnd")[];
2698
+ /** True when nothing changed — every VortEX hook was already present. */
2699
+ readonly alreadyWired: boolean;
2700
+ }
2701
+ /**
2702
+ * Parse existing settings.json text. Empty/whitespace → `{}` (fresh). Throws on
2703
+ * malformed JSON so the caller aborts rather than clobbering a hand-edited file.
2704
+ */
2705
+ declare function parseSettings(text: string | null | undefined): ClaudeSettings;
2706
+ /**
2707
+ * Merge the VortEX hooks into an existing settings object WITHOUT mutating the
2708
+ * input. A hook event is left untouched if it already references our command
2709
+ * (idempotent); otherwise our group is appended alongside any existing groups.
2710
+ */
2711
+ declare function ensureVortexHooks(existing: ClaudeSettings | null | undefined): EnsureHooksResult;
2712
+ /** Serialize settings the way Claude writes them (2-space, trailing newline). */
2713
+ declare function serializeSettings(settings: ClaudeSettings): string;
2714
+
2715
+ /**
2716
+ * Global usage setup — make a VortEX instance reachable from ANY folder, not
2717
+ * just the instance directory. The lever is the user's GLOBAL Claude config
2718
+ * (`~/.claude/`), which Claude Code reads in every project:
2719
+ *
2720
+ * 1. `~/.claude/settings.json` — global SessionStart/SessionEnd hooks, so
2721
+ * the boot report + worklog-net fire in every folder. SAME command string
2722
+ * as the per-instance hook, so Claude Code's identical-hook dedup means the
2723
+ * instance folder never double-fires.
2724
+ * 2. `~/.claude/vortex-global.json` — a small pointer file recording the
2725
+ * instance path (and a decline marker). `resolveRepoRoot()` reads
2726
+ * `instanceRoot` so commands run from any folder record to the one instance
2727
+ * WITHOUT needing an env var baked into the hook command (which would be
2728
+ * shell-dependent and would break hook dedup).
2729
+ * 3. `~/.claude/CLAUDE.md` — a small, marker-delimited pointer block
2730
+ * telling the agent where the instance is and to read its `AI-RULES.md` for
2731
+ * VortEX work. Regenerated in place; the user's other CLAUDE.md content is
2732
+ * preserved.
2733
+ *
2734
+ * Every write is merge-safe and idempotent. Pure helpers (block upsert, state
2735
+ * read) are separated from the thin fs wrappers so the merge is unit-testable.
2736
+ * All functions take an explicit `home` (default `os.homedir()`) so tests can
2737
+ * point at a fake home without touching the real `~/.claude`.
2738
+ */
2739
+
2740
+ declare function globalSettingsPath(home?: string): string;
2741
+ /** The pointer/state file: `{ instanceRoot?, declinedAt? }`. */
2742
+ declare function globalStatePath(home?: string): string;
2743
+ declare function globalMemoryPath(home?: string): string;
2744
+ /**
2745
+ * The instance root recorded by a prior `vortex global-setup`, or null. Read by
2746
+ * `resolveRepoRoot()` so any-folder commands target the central instance.
2747
+ */
2748
+ declare function readGlobalInstancePointer(home?: string): string | null;
2749
+ /**
2750
+ * Does `dir` look like an initialized VortEX instance? Used by
2751
+ * `resolveRepoRoot()` so that running INSIDE any instance uses that instance,
2752
+ * and only falls back to the global pointer elsewhere.
2753
+ */
2754
+ declare function isInstanceRoot(dir: string): boolean;
2755
+ /** True if the global settings.json already carries BOTH our session hooks. */
2756
+ declare function globalSettingsHasHook(home?: string): boolean;
2757
+ /**
2758
+ * State of global usage on this machine. `done` = pointer set AND global hook
2759
+ * wired (and, if `instanceRoot` given, the pointer matches it). `declined` = the
2760
+ * user dismissed the offer. The session-start offer shows only when neither.
2761
+ */
2762
+ declare function inspectGlobalSetup(home?: string, instanceRoot?: string): {
2763
+ readonly done: boolean;
2764
+ readonly declined: boolean;
2765
+ };
2766
+ /** The marker-delimited pointer block written into the global CLAUDE.md. */
2767
+ declare function renderGlobalBlock(instanceRoot: string): string;
2768
+ /**
2769
+ * Insert or replace the VortEX block in an existing CLAUDE.md, preserving all
2770
+ * other content. Idempotent: a second call with the same instanceRoot returns
2771
+ * identical text.
2772
+ */
2773
+ declare function upsertGlobalBlock(existing: string, instanceRoot: string): string;
2774
+ interface GlobalSetupWrite {
2775
+ readonly created: readonly string[];
2776
+ readonly modified: readonly string[];
2777
+ readonly skipped: readonly string[];
2778
+ }
2779
+ /**
2780
+ * Apply global usage setup for `instanceRoot`: merge global hooks, write the
2781
+ * pointer, and upsert the CLAUDE.md block. Non-destructive and idempotent —
2782
+ * re-running with the same instance is a no-op (everything reported `skipped`).
2783
+ */
2784
+ declare function applyGlobalSetup(opts: {
2785
+ readonly instanceRoot: string;
2786
+ readonly home?: string;
2787
+ }): Promise<GlobalSetupWrite>;
2788
+ /**
2789
+ * Record that the user declined the global-usage offer, so the session-start
2790
+ * report stops offering it. Preserves any existing pointer. Returns the path
2791
+ * written.
2792
+ */
2793
+ declare function recordGlobalSetupDecline(opts?: {
2794
+ readonly home?: string;
2795
+ readonly now?: Date;
2796
+ }): Promise<string>;
2594
2797
 
2595
2798
  /** The two document actions the v1 value loop supports. */
2596
2799
  type CurateActionKind = "create-file" | "append-section";
@@ -2841,6 +3044,19 @@ interface SessionStartHookReport {
2841
3044
  }[];
2842
3045
  /** Always-on memories dropped because the count exceeded the cap (0 = none). */
2843
3046
  readonly alwaysOnOverflow: number;
3047
+ /**
3048
+ * The on-demand **action-trigger catalog**: behavioral memories (`scope !=
3049
+ * always`, classified action-trigger) surfaced as compact `slug — description`
3050
+ * HINTS so the agent knows they exist and opens the full memory when its next
3051
+ * action matches. NOT the rule bodies (those stay on `/recall`); capped tight
3052
+ * (row + total + per-row) so it never grows into a context tax.
3053
+ */
3054
+ readonly actionTriggers: readonly {
3055
+ readonly slug: string;
3056
+ readonly description: string;
3057
+ }[];
3058
+ /** Action-trigger rows dropped by the row/total-char cap (0 = none). */
3059
+ readonly actionTriggerOverflow: number;
2844
3060
  /**
2845
3061
  * The on-demand index looks stale — suggest `reindex`. True when memories
2846
3062
  * exist but `_INDEX.md` is missing, or a `_memory/*.md` is newer than it.
@@ -2863,6 +3079,13 @@ declare function collectSessionStartReport(ctx: ModuleContext, opts?: {
2863
3079
  * hook supplies `commitDays` from git; the report supplies the present dates.
2864
3080
  */
2865
3081
  declare function detectWorklogGaps(commitDays: readonly string[], presentDates: readonly string[]): string[];
3082
+ /**
3083
+ * Count changed paths in `git status --porcelain` output — one path per
3084
+ * non-empty line. Pure: the hook runs git; this turns its stdout into the
3085
+ * Tier-1 carryover count. (`--porcelain` emits exactly one line per changed
3086
+ * path, including untracked, so a line count is the change count.)
3087
+ */
3088
+ declare function countUncommitted(porcelain: string): number;
2866
3089
  /**
2867
3090
  * Render a session-start report as a compact markdown block for a host hook
2868
3091
  * to inject as session context. A pull conflict and any worklog gaps are
@@ -2909,6 +3132,24 @@ declare function renderSessionStartReport(report: SessionStartHookReport, extras
2909
3132
  readonly command: string | null;
2910
3133
  readonly registry: string;
2911
3134
  };
3135
+ /**
3136
+ * One-time offer: this machine has not enabled "VortEX from any folder" and
3137
+ * the user hasn't declined. The agent asks once; on yes → `vortex
3138
+ * global-setup`, on no → `vortex global-setup --decline` (so it stops asking).
3139
+ */
3140
+ readonly globalSetupOffer?: boolean;
3141
+ /**
3142
+ * Tier-1 session-resume signals (cheap, git-only; computed by the hook):
3143
+ * work carried over from a prior session. `interrupted` names an in-progress
3144
+ * git op (MERGE_HEAD / rebase / lock) — a near-certain crash signal, surfaced
3145
+ * as ⚠️. `uncommitted` counts changed paths present at session start — common
3146
+ * in normal WIP, so surfaced as a quiet informational line only. Both point at
3147
+ * `/resume` (Tier 2). See decision-log 2026-06-04-session-recovery-two-tier.
3148
+ */
3149
+ readonly carryover?: {
3150
+ readonly uncommitted: number;
3151
+ readonly interrupted: string | null;
3152
+ };
2912
3153
  }): string;
2913
3154
 
2914
3155
  /**
@@ -2980,56 +3221,6 @@ interface CatchUpOptions {
2980
3221
  }
2981
3222
  declare function catchUpSessions(ctx: ModuleContext, opts?: CatchUpOptions): Promise<CatchUpResult>;
2982
3223
 
2983
- /**
2984
- * Hook wiring for `/vortex init`: make sure the instance's
2985
- * `.claude/settings.json` registers the VortEX SessionStart / SessionEnd hooks,
2986
- * so the boot report + worklog-net fire automatically without the user knowing
2987
- * any command. NON-DESTRUCTIVE — like the MCP install merge, this preserves
2988
- * every other hook and top-level field and only adds our two entries if absent.
2989
- *
2990
- * Pure functions here (parse / merge / detect); the command does the actual
2991
- * file read/write around them. Keeping them pure makes the merge unit-testable
2992
- * and the "writes only what's missing" guarantee verifiable.
2993
- */
2994
- declare const SESSION_START_COMMAND = "npx --no-install -p @vortex-os/base vortex session-start";
2995
- declare const SESSION_END_COMMAND = "npx --no-install -p @vortex-os/base vortex session-end";
2996
- interface HookCommand {
2997
- readonly type: "command";
2998
- readonly command: string;
2999
- }
3000
- interface HookGroup {
3001
- readonly hooks: readonly HookCommand[];
3002
- readonly matcher?: string;
3003
- }
3004
- interface ClaudeSettings {
3005
- hooks?: {
3006
- SessionStart?: HookGroup[];
3007
- SessionEnd?: HookGroup[];
3008
- [event: string]: HookGroup[] | undefined;
3009
- };
3010
- [key: string]: unknown;
3011
- }
3012
- interface EnsureHooksResult {
3013
- readonly settings: ClaudeSettings;
3014
- /** Which hook events we added a VortEX entry to (empty if already wired). */
3015
- readonly added: readonly ("SessionStart" | "SessionEnd")[];
3016
- /** True when nothing changed — every VortEX hook was already present. */
3017
- readonly alreadyWired: boolean;
3018
- }
3019
- /**
3020
- * Parse existing settings.json text. Empty/whitespace → `{}` (fresh). Throws on
3021
- * malformed JSON so the caller aborts rather than clobbering a hand-edited file.
3022
- */
3023
- declare function parseSettings(text: string | null | undefined): ClaudeSettings;
3024
- /**
3025
- * Merge the VortEX hooks into an existing settings object WITHOUT mutating the
3026
- * input. A hook event is left untouched if it already references our command
3027
- * (idempotent); otherwise our group is appended alongside any existing groups.
3028
- */
3029
- declare function ensureVortexHooks(existing: ClaudeSettings | null | undefined): EnsureHooksResult;
3030
- /** Serialize settings the way Claude writes them (2-space, trailing newline). */
3031
- declare function serializeSettings(settings: ClaudeSettings): string;
3032
-
3033
3224
  interface ReindexResult {
3034
3225
  readonly dir: string;
3035
3226
  readonly status: "written" | "unchanged" | "missing";
@@ -3180,8 +3371,12 @@ declare function renderAgenda(report: AgendaReport): string;
3180
3371
  */
3181
3372
  declare const agendaCommand: Command<AgendaReport>;
3182
3373
 
3183
- /** Schema tag for the ownership manifest; bump on a breaking shape change. */
3184
- declare const OWNERSHIP_SCHEMA = "vortex-ownership/1";
3374
+ /**
3375
+ * Schema tag for the ownership manifest; bump on a breaking shape change.
3376
+ * v2: hashes are EOL-normalized (LF) content hashes, not raw bytes — a pre-v2
3377
+ * (raw-byte) manifest is migrated in memory on read (see `migrateOwnershipToV2`).
3378
+ */
3379
+ declare const OWNERSHIP_SCHEMA = "vortex-ownership/2";
3185
3380
  /** A single framework-owned file the instance tracks for updates. */
3186
3381
  interface OwnershipEntry {
3187
3382
  /** Stable id across path moves — currently the template-relative path. */
@@ -3207,7 +3402,7 @@ interface OwnershipManifest {
3207
3402
  readonly generatedAt: string;
3208
3403
  readonly files: readonly OwnershipEntry[];
3209
3404
  }
3210
- type UpdateFileActionKind = "replace" | "restore" | "install" | "conflict" | "locally-modified" | "unmanaged" | "removed-upstream" | "unchanged";
3405
+ type UpdateFileActionKind = "replace" | "restore" | "install" | "conflict" | "locally-modified" | "unmanaged" | "adopt" | "removed-upstream" | "unchanged";
3211
3406
  interface UpdateFileAction {
3212
3407
  readonly path: string;
3213
3408
  readonly templateId: string;
@@ -3237,6 +3432,8 @@ interface VortexUpdateResult {
3237
3432
  readonly conflicts: number;
3238
3433
  readonly unchanged: number;
3239
3434
  readonly unmanaged: number;
3435
+ /** Files force-refreshed to the template via `--adopt` (prior bytes backed up). */
3436
+ readonly adopted: number;
3240
3437
  readonly locallyModified: number;
3241
3438
  readonly removedUpstream: number;
3242
3439
  /** Files whose apply threw (left unchanged) — surfaces a partial run. */
@@ -3302,7 +3499,7 @@ interface OwnershipDiagnosis {
3302
3499
  * files are stock, user-edited, missing, or foreign. No template index needed
3303
3500
  * (it compares disk to the recorded `installedSha256`, not to a new template).
3304
3501
  */
3305
- declare function inspectOwnership(ctx: ModuleContext): Promise<OwnershipDiagnosis>;
3502
+ declare function inspectOwnership(ctx: ModuleContext, templatesDir?: string | null): Promise<OwnershipDiagnosis>;
3306
3503
  /**
3307
3504
  * Adopt / repair the ownership manifest for an instance that lacks one (e.g.
3308
3505
  * created before the update lifecycle existed). Conservative by design: it does
@@ -3326,6 +3523,7 @@ declare function repairOwnershipManifest(ctx: ModuleContext, templatesDir: strin
3326
3523
  */
3327
3524
  declare function runTemplatesUpdate(ctx: ModuleContext, templatesDir: string | null, options?: {
3328
3525
  dryRun?: boolean;
3526
+ adopt?: ReadonlySet<string>;
3329
3527
  }): Promise<VortexUpdateResult>;
3330
3528
 
3331
3529
  /**
@@ -3488,8 +3686,23 @@ interface VortexSyncResult {
3488
3686
  readonly failedAt?: VortexSyncStepId;
3489
3687
  readonly nextActions: readonly string[];
3490
3688
  }
3491
- type VortexResult = VortexInitResult | VortexStatusResult | VortexImportResult | VortexDoctorResult | VortexSyncResult | VortexUpdateResult | VortexPlannedResult | VortexHelpResult;
3689
+ interface VortexGlobalSetupResult {
3690
+ readonly subcommand: "global-setup";
3691
+ readonly status: "completed" | "declined" | "error";
3692
+ readonly created: readonly string[];
3693
+ readonly modified: readonly string[];
3694
+ readonly skipped: readonly string[];
3695
+ readonly nextActions: readonly string[];
3696
+ }
3697
+ type VortexResult = VortexInitResult | VortexStatusResult | VortexImportResult | VortexDoctorResult | VortexSyncResult | VortexUpdateResult | VortexGlobalSetupResult | VortexPlannedResult | VortexHelpResult;
3492
3698
  declare const vortexCommand: Command<VortexResult>;
3699
+ /**
3700
+ * Parse `--adopt <path>` (repeatable) tokens into the POSIX, repoRoot-relative
3701
+ * dest paths the ownership manifest uses, so a Windows-style argument
3702
+ * (`.claude\commands\recall.md` or a leading `./`) still matches a slot. The
3703
+ * value is the dest path shown in the update report. Exported for tests.
3704
+ */
3705
+ declare function parseAdoptArgs(tokens: readonly string[]): Set<string>;
3493
3706
 
3494
3707
  interface UpdateCheckResult {
3495
3708
  readonly package: string;
@@ -3607,35 +3820,50 @@ type index_d_VortexSyncStepStatus = VortexSyncStepStatus;
3607
3820
  type index_d_VortexUpdateResult = VortexUpdateResult;
3608
3821
  type index_d_WorklogAppendResult = WorklogAppendResult;
3609
3822
  declare const index_d_agendaCommand: typeof agendaCommand;
3823
+ declare const index_d_applyGlobalSetup: typeof applyGlobalSetup;
3824
+ declare const index_d_argvToSlash: typeof argvToSlash;
3610
3825
  declare const index_d_buildInstallCommand: typeof buildInstallCommand;
3611
3826
  declare const index_d_buildOwnershipManifest: typeof buildOwnershipManifest;
3612
3827
  declare const index_d_buildRegistry: typeof buildRegistry;
3613
3828
  declare const index_d_catchUpSessions: typeof catchUpSessions;
3614
3829
  declare const index_d_checkBaseUpdate: typeof checkBaseUpdate;
3615
3830
  declare const index_d_collectAgenda: typeof collectAgenda;
3831
+ declare const index_d_collectCarryover: typeof collectCarryover;
3616
3832
  declare const index_d_collectSessionStartReport: typeof collectSessionStartReport;
3617
3833
  declare const index_d_compareSemver: typeof compareSemver;
3618
3834
  declare const index_d_computeCurateFingerprint: typeof computeCurateFingerprint;
3835
+ declare const index_d_countUncommitted: typeof countUncommitted;
3619
3836
  declare const index_d_createAmbientRecaller: typeof createAmbientRecaller;
3620
3837
  declare const index_d_createRitualRegistry: typeof createRitualRegistry;
3621
3838
  declare const index_d_curateCommand: typeof curateCommand;
3622
3839
  declare const index_d_decisionCommand: typeof decisionCommand;
3840
+ declare const index_d_detectInterruptedGitOp: typeof detectInterruptedGitOp;
3623
3841
  declare const index_d_detectWorklogGaps: typeof detectWorklogGaps;
3624
3842
  declare const index_d_ensureVortexHooks: typeof ensureVortexHooks;
3625
3843
  declare const index_d_ensureWorklogEntry: typeof ensureWorklogEntry;
3626
3844
  declare const index_d_extractNextUp: typeof extractNextUp;
3627
3845
  declare const index_d_extractOpenTasks: typeof extractOpenTasks;
3846
+ declare const index_d_globalMemoryPath: typeof globalMemoryPath;
3847
+ declare const index_d_globalSettingsHasHook: typeof globalSettingsHasHook;
3848
+ declare const index_d_globalSettingsPath: typeof globalSettingsPath;
3849
+ declare const index_d_globalStatePath: typeof globalStatePath;
3850
+ declare const index_d_inspectGlobalSetup: typeof inspectGlobalSetup;
3628
3851
  declare const index_d_inspectOwnership: typeof inspectOwnership;
3852
+ declare const index_d_isInstanceRoot: typeof isInstanceRoot;
3629
3853
  declare const index_d_isNewer: typeof isNewer;
3630
3854
  declare const index_d_isStableUpdate: typeof isStableUpdate;
3631
3855
  declare const index_d_logCommand: typeof logCommand;
3632
3856
  declare const index_d_ownershipManifestPath: typeof ownershipManifestPath;
3857
+ declare const index_d_parseAdoptArgs: typeof parseAdoptArgs;
3633
3858
  declare const index_d_parseSettings: typeof parseSettings;
3634
3859
  declare const index_d_queryNpmLatest: typeof queryNpmLatest;
3860
+ declare const index_d_readGlobalInstancePointer: typeof readGlobalInstancePointer;
3635
3861
  declare const index_d_readInstalledBaseVersion: typeof readInstalledBaseVersion;
3636
3862
  declare const index_d_recallCommand: typeof recallCommand;
3863
+ declare const index_d_recordGlobalSetupDecline: typeof recordGlobalSetupDecline;
3637
3864
  declare const index_d_reindexCommand: typeof reindexCommand;
3638
3865
  declare const index_d_renderAgenda: typeof renderAgenda;
3866
+ declare const index_d_renderGlobalBlock: typeof renderGlobalBlock;
3639
3867
  declare const index_d_renderSessionStartReport: typeof renderSessionStartReport;
3640
3868
  declare const index_d_repairOwnershipManifest: typeof repairOwnershipManifest;
3641
3869
  declare const index_d_resolveRepoRoot: typeof resolveRepoRoot;
@@ -3648,11 +3876,12 @@ declare const index_d_runVortexCli: typeof runVortexCli;
3648
3876
  declare const index_d_serializeSettings: typeof serializeSettings;
3649
3877
  declare const index_d_sessionStartCommand: typeof sessionStartCommand;
3650
3878
  declare const index_d_templateDestRelPath: typeof templateDestRelPath;
3879
+ declare const index_d_upsertGlobalBlock: typeof upsertGlobalBlock;
3651
3880
  declare const index_d_validateCuratePayload: typeof validateCuratePayload;
3652
3881
  declare const index_d_vortexCommand: typeof vortexCommand;
3653
3882
  declare const index_d_writeOwnershipManifest: typeof writeOwnershipManifest;
3654
3883
  declare namespace index_d {
3655
- export { type index_d_AgendaReport as AgendaReport, type index_d_AmbientRecallFactoryOptions as AmbientRecallFactoryOptions, type index_d_CatchUpOptions as CatchUpOptions, type index_d_CatchUpResult as CatchUpResult, type index_d_ClaudeSettings as ClaudeSettings, type index_d_CliIo as CliIo, type index_d_CollectAgendaOptions as CollectAgendaOptions, type index_d_CurateAcceptResult as CurateAcceptResult, type index_d_CurateActionKind as CurateActionKind, type index_d_CurateAnyProposal as CurateAnyProposal, type index_d_CurateCandidate as CurateCandidate, type index_d_CurateCandidatesResult as CurateCandidatesResult, type index_d_CurateDeclineResult as CurateDeclineResult, type index_d_CurateOptions as CurateOptions, type index_d_CuratePayload as CuratePayload, type index_d_CuratePayloadValidation as CuratePayloadValidation, type index_d_CuratePreviewResult as CuratePreviewResult, type index_d_CurateResult as CurateResult, type index_d_EnsureHooksResult as EnsureHooksResult, type index_d_EnsureWorklogResult as EnsureWorklogResult, type index_d_GitPullResult as GitPullResult, type index_d_NewDecisionResult as NewDecisionResult, index_d_OWNERSHIP_SCHEMA as OWNERSHIP_SCHEMA, type index_d_OpenDecision as OpenDecision, type index_d_OpenTask as OpenTask, type index_d_OwnershipDiagnosis as OwnershipDiagnosis, type index_d_OwnershipEntry as OwnershipEntry, type index_d_OwnershipManifest as OwnershipManifest, type index_d_RecallOptions as RecallOptions, type index_d_RecentWorklog as RecentWorklog, type index_d_ReindexResult as ReindexResult, type index_d_RitualRegistryOptions as RitualRegistryOptions, index_d_SESSION_END_COMMAND as SESSION_END_COMMAND, index_d_SESSION_START_COMMAND as SESSION_START_COMMAND, type index_d_SessionStartHookReport as SessionStartHookReport, type index_d_SessionStartReport as SessionStartReport, type index_d_UpdateCheckResult as UpdateCheckResult, type index_d_UpdateFileAction as UpdateFileAction, type index_d_UpdateFileActionKind as UpdateFileActionKind, type index_d_VortexHelpResult as VortexHelpResult, type index_d_VortexInitResult as VortexInitResult, type index_d_VortexPlannedResult as VortexPlannedResult, type index_d_VortexResult as VortexResult, type index_d_VortexSyncResult as VortexSyncResult, type index_d_VortexSyncStep as VortexSyncStep, type index_d_VortexSyncStepId as VortexSyncStepId, type index_d_VortexSyncStepStatus as VortexSyncStepStatus, type index_d_VortexUpdateResult as VortexUpdateResult, type index_d_WorklogAppendResult as WorklogAppendResult, index_d_agendaCommand as agendaCommand, index_d_buildInstallCommand as buildInstallCommand, index_d_buildOwnershipManifest as buildOwnershipManifest, index_d_buildRegistry as buildRegistry, index_d_catchUpSessions as catchUpSessions, index_d_checkBaseUpdate as checkBaseUpdate, index_d_collectAgenda as collectAgenda, index_d_collectSessionStartReport as collectSessionStartReport, index_d_compareSemver as compareSemver, index_d_computeCurateFingerprint as computeCurateFingerprint, index_d_createAmbientRecaller as createAmbientRecaller, index_d_createRitualRegistry as createRitualRegistry, index_d_curateCommand as curateCommand, index_d_decisionCommand as decisionCommand, index_d_detectWorklogGaps as detectWorklogGaps, index_d_ensureVortexHooks as ensureVortexHooks, index_d_ensureWorklogEntry as ensureWorklogEntry, index_d_extractNextUp as extractNextUp, index_d_extractOpenTasks as extractOpenTasks, index_d_inspectOwnership as inspectOwnership, index_d_isNewer as isNewer, index_d_isStableUpdate as isStableUpdate, index_d_logCommand as logCommand, index_d_ownershipManifestPath as ownershipManifestPath, index_d_parseSettings as parseSettings, index_d_queryNpmLatest as queryNpmLatest, index_d_readInstalledBaseVersion as readInstalledBaseVersion, index_d_recallCommand as recallCommand, index_d_reindexCommand as reindexCommand, index_d_renderAgenda as renderAgenda, index_d_renderSessionStartReport as renderSessionStartReport, index_d_repairOwnershipManifest as repairOwnershipManifest, index_d_resolveRepoRoot as resolveRepoRoot, index_d_runCurateAccept as runCurateAccept, index_d_runCurateCandidates as runCurateCandidates, index_d_runCurateDecline as runCurateDecline, index_d_runCuratePreview as runCuratePreview, index_d_runTemplatesUpdate as runTemplatesUpdate, index_d_runVortexCli as runVortexCli, index_d_serializeSettings as serializeSettings, index_d_sessionStartCommand as sessionStartCommand, index_d_templateDestRelPath as templateDestRelPath, index_d_validateCuratePayload as validateCuratePayload, index_d_vortexCommand as vortexCommand, index_d_writeOwnershipManifest as writeOwnershipManifest };
3884
+ export { type index_d_AgendaReport as AgendaReport, type index_d_AmbientRecallFactoryOptions as AmbientRecallFactoryOptions, type index_d_CatchUpOptions as CatchUpOptions, type index_d_CatchUpResult as CatchUpResult, type index_d_ClaudeSettings as ClaudeSettings, type index_d_CliIo as CliIo, type index_d_CollectAgendaOptions as CollectAgendaOptions, type index_d_CurateAcceptResult as CurateAcceptResult, type index_d_CurateActionKind as CurateActionKind, type index_d_CurateAnyProposal as CurateAnyProposal, type index_d_CurateCandidate as CurateCandidate, type index_d_CurateCandidatesResult as CurateCandidatesResult, type index_d_CurateDeclineResult as CurateDeclineResult, type index_d_CurateOptions as CurateOptions, type index_d_CuratePayload as CuratePayload, type index_d_CuratePayloadValidation as CuratePayloadValidation, type index_d_CuratePreviewResult as CuratePreviewResult, type index_d_CurateResult as CurateResult, type index_d_EnsureHooksResult as EnsureHooksResult, type index_d_EnsureWorklogResult as EnsureWorklogResult, type index_d_GitPullResult as GitPullResult, type index_d_NewDecisionResult as NewDecisionResult, index_d_OWNERSHIP_SCHEMA as OWNERSHIP_SCHEMA, type index_d_OpenDecision as OpenDecision, type index_d_OpenTask as OpenTask, type index_d_OwnershipDiagnosis as OwnershipDiagnosis, type index_d_OwnershipEntry as OwnershipEntry, type index_d_OwnershipManifest as OwnershipManifest, type index_d_RecallOptions as RecallOptions, type index_d_RecentWorklog as RecentWorklog, type index_d_ReindexResult as ReindexResult, type index_d_RitualRegistryOptions as RitualRegistryOptions, index_d_SESSION_END_COMMAND as SESSION_END_COMMAND, index_d_SESSION_START_COMMAND as SESSION_START_COMMAND, type index_d_SessionStartHookReport as SessionStartHookReport, type index_d_SessionStartReport as SessionStartReport, type index_d_UpdateCheckResult as UpdateCheckResult, type index_d_UpdateFileAction as UpdateFileAction, type index_d_UpdateFileActionKind as UpdateFileActionKind, type index_d_VortexHelpResult as VortexHelpResult, type index_d_VortexInitResult as VortexInitResult, type index_d_VortexPlannedResult as VortexPlannedResult, type index_d_VortexResult as VortexResult, type index_d_VortexSyncResult as VortexSyncResult, type index_d_VortexSyncStep as VortexSyncStep, type index_d_VortexSyncStepId as VortexSyncStepId, type index_d_VortexSyncStepStatus as VortexSyncStepStatus, type index_d_VortexUpdateResult as VortexUpdateResult, type index_d_WorklogAppendResult as WorklogAppendResult, index_d_agendaCommand as agendaCommand, index_d_applyGlobalSetup as applyGlobalSetup, index_d_argvToSlash as argvToSlash, index_d_buildInstallCommand as buildInstallCommand, index_d_buildOwnershipManifest as buildOwnershipManifest, index_d_buildRegistry as buildRegistry, index_d_catchUpSessions as catchUpSessions, index_d_checkBaseUpdate as checkBaseUpdate, index_d_collectAgenda as collectAgenda, index_d_collectCarryover as collectCarryover, index_d_collectSessionStartReport as collectSessionStartReport, index_d_compareSemver as compareSemver, index_d_computeCurateFingerprint as computeCurateFingerprint, index_d_countUncommitted as countUncommitted, index_d_createAmbientRecaller as createAmbientRecaller, index_d_createRitualRegistry as createRitualRegistry, index_d_curateCommand as curateCommand, index_d_decisionCommand as decisionCommand, index_d_detectInterruptedGitOp as detectInterruptedGitOp, index_d_detectWorklogGaps as detectWorklogGaps, index_d_ensureVortexHooks as ensureVortexHooks, index_d_ensureWorklogEntry as ensureWorklogEntry, index_d_extractNextUp as extractNextUp, index_d_extractOpenTasks as extractOpenTasks, index_d_globalMemoryPath as globalMemoryPath, index_d_globalSettingsHasHook as globalSettingsHasHook, index_d_globalSettingsPath as globalSettingsPath, index_d_globalStatePath as globalStatePath, index_d_inspectGlobalSetup as inspectGlobalSetup, index_d_inspectOwnership as inspectOwnership, index_d_isInstanceRoot as isInstanceRoot, index_d_isNewer as isNewer, index_d_isStableUpdate as isStableUpdate, index_d_logCommand as logCommand, index_d_ownershipManifestPath as ownershipManifestPath, index_d_parseAdoptArgs as parseAdoptArgs, index_d_parseSettings as parseSettings, index_d_queryNpmLatest as queryNpmLatest, index_d_readGlobalInstancePointer as readGlobalInstancePointer, index_d_readInstalledBaseVersion as readInstalledBaseVersion, index_d_recallCommand as recallCommand, index_d_recordGlobalSetupDecline as recordGlobalSetupDecline, index_d_reindexCommand as reindexCommand, index_d_renderAgenda as renderAgenda, index_d_renderGlobalBlock as renderGlobalBlock, index_d_renderSessionStartReport as renderSessionStartReport, index_d_repairOwnershipManifest as repairOwnershipManifest, index_d_resolveRepoRoot as resolveRepoRoot, index_d_runCurateAccept as runCurateAccept, index_d_runCurateCandidates as runCurateCandidates, index_d_runCurateDecline as runCurateDecline, index_d_runCuratePreview as runCuratePreview, index_d_runTemplatesUpdate as runTemplatesUpdate, index_d_runVortexCli as runVortexCli, index_d_serializeSettings as serializeSettings, index_d_sessionStartCommand as sessionStartCommand, index_d_templateDestRelPath as templateDestRelPath, index_d_upsertGlobalBlock as upsertGlobalBlock, index_d_validateCuratePayload as validateCuratePayload, index_d_vortexCommand as vortexCommand, index_d_writeOwnershipManifest as writeOwnershipManifest };
3656
3885
  }
3657
3886
 
3658
3887
  export { index_d$9 as aiCodingPitfalls, index_d$d as core, index_d$a as dataLint, index_d$5 as decisionLog, index_d$4 as indexGenerator, index_d$2 as linkRewriter, index_d$b as memorySystem, index_d$1 as proactiveCurator, index_d$7 as reportGenerator, index_d$3 as runbooks, index_d as sessionRituals, index_d$c as slashCommands, index_d$8 as toolRules, index_d$6 as worklog };