ctxr-cli 0.20.1 → 0.22.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.
Files changed (100) hide show
  1. package/README.md +55 -8
  2. package/dist/adapters/builtin/index.d.ts.map +1 -1
  3. package/dist/adapters/builtin/index.js +8 -1
  4. package/dist/adapters/builtin/index.js.map +1 -1
  5. package/dist/adapters/harness/antigravity.d.ts +18 -0
  6. package/dist/adapters/harness/antigravity.d.ts.map +1 -0
  7. package/dist/adapters/harness/antigravity.js +24 -0
  8. package/dist/adapters/harness/antigravity.js.map +1 -0
  9. package/dist/adapters/harness/codex.d.ts +22 -0
  10. package/dist/adapters/harness/codex.d.ts.map +1 -0
  11. package/dist/adapters/harness/codex.js +28 -0
  12. package/dist/adapters/harness/codex.js.map +1 -0
  13. package/dist/adapters/types.d.ts +9 -0
  14. package/dist/adapters/types.d.ts.map +1 -1
  15. package/dist/commands/archive.d.ts +4 -3
  16. package/dist/commands/archive.d.ts.map +1 -1
  17. package/dist/commands/archive.js +28 -23
  18. package/dist/commands/archive.js.map +1 -1
  19. package/dist/commands/ingest.d.ts.map +1 -1
  20. package/dist/commands/ingest.js +22 -1
  21. package/dist/commands/ingest.js.map +1 -1
  22. package/dist/commands/init.d.ts +2 -0
  23. package/dist/commands/init.d.ts.map +1 -1
  24. package/dist/commands/init.js +20 -3
  25. package/dist/commands/init.js.map +1 -1
  26. package/dist/commands/publish-urls.d.ts +32 -0
  27. package/dist/commands/publish-urls.d.ts.map +1 -0
  28. package/dist/commands/publish-urls.js +125 -0
  29. package/dist/commands/publish-urls.js.map +1 -0
  30. package/dist/config/defaults.d.ts +26 -0
  31. package/dist/config/defaults.d.ts.map +1 -1
  32. package/dist/config/defaults.js +25 -1
  33. package/dist/config/defaults.js.map +1 -1
  34. package/dist/config/schema.d.ts +19 -0
  35. package/dist/config/schema.d.ts.map +1 -1
  36. package/dist/config/schema.js +31 -0
  37. package/dist/config/schema.js.map +1 -1
  38. package/dist/core/agents-doc.d.ts +26 -0
  39. package/dist/core/agents-doc.d.ts.map +1 -1
  40. package/dist/core/agents-doc.js +94 -40
  41. package/dist/core/agents-doc.js.map +1 -1
  42. package/dist/core/checks/harness-portability-checks.d.ts +32 -0
  43. package/dist/core/checks/harness-portability-checks.d.ts.map +1 -1
  44. package/dist/core/checks/harness-portability-checks.js +177 -2
  45. package/dist/core/checks/harness-portability-checks.js.map +1 -1
  46. package/dist/core/checks/integrity-checks.d.ts.map +1 -1
  47. package/dist/core/checks/integrity-checks.js +34 -14
  48. package/dist/core/checks/integrity-checks.js.map +1 -1
  49. package/dist/core/checks/organize-checks.d.ts +5 -0
  50. package/dist/core/checks/organize-checks.d.ts.map +1 -1
  51. package/dist/core/checks/organize-checks.js +57 -4
  52. package/dist/core/checks/organize-checks.js.map +1 -1
  53. package/dist/core/convention-doc.d.ts.map +1 -1
  54. package/dist/core/convention-doc.js +5 -2
  55. package/dist/core/convention-doc.js.map +1 -1
  56. package/dist/core/conventions.d.ts +7 -0
  57. package/dist/core/conventions.d.ts.map +1 -1
  58. package/dist/core/conventions.js +3 -0
  59. package/dist/core/conventions.js.map +1 -1
  60. package/dist/core/errors.d.ts +22 -0
  61. package/dist/core/errors.d.ts.map +1 -1
  62. package/dist/core/errors.js +52 -0
  63. package/dist/core/errors.js.map +1 -1
  64. package/dist/core/ingest/required-sections.d.ts +3 -3
  65. package/dist/core/ingest/required-sections.d.ts.map +1 -1
  66. package/dist/core/ingest/required-sections.js +79 -16
  67. package/dist/core/ingest/required-sections.js.map +1 -1
  68. package/dist/core/notes/list.d.ts.map +1 -1
  69. package/dist/core/notes/list.js +3 -0
  70. package/dist/core/notes/list.js.map +1 -1
  71. package/dist/core/reconcile.d.ts.map +1 -1
  72. package/dist/core/reconcile.js +2 -1
  73. package/dist/core/reconcile.js.map +1 -1
  74. package/dist/core/skills.d.ts.map +1 -1
  75. package/dist/core/skills.js +28 -4
  76. package/dist/core/skills.js.map +1 -1
  77. package/dist/run.d.ts.map +1 -1
  78. package/dist/run.js +15 -2
  79. package/dist/run.js.map +1 -1
  80. package/dist/version.d.ts +1 -1
  81. package/dist/version.js +1 -1
  82. package/package.json +3 -3
  83. package/templates/agents/canonical.md +3 -8
  84. package/templates/agents/capture-and-ingest.md +1 -36
  85. package/templates/agents/conventions.md +3 -1
  86. package/templates/agents/guidance-index.md +5 -0
  87. package/templates/agents/mission.md +2 -0
  88. package/templates/agents/retrieval-leg-routing.md +7 -42
  89. package/templates/conventions/baseline-conventions.md +20 -9
  90. package/templates/conventions/house-conventions-seed.md +10 -0
  91. package/templates/skills/ctxr-capture.md +35 -4
  92. package/templates/skills/ctxr-derived-artifacts.md +6 -0
  93. package/templates/skills/ctxr-ingest-orchestration.md +5 -1
  94. package/templates/skills/ctxr-mission.md +40 -31
  95. package/templates/skills/ctxr-organize-audit.md +30 -6
  96. package/templates/skills/ctxr-placement.md +5 -0
  97. package/templates/skills/ctxr-publish.md +2 -1
  98. package/templates/skills/ctxr-research.md +108 -0
  99. package/templates/skills/ctxr-second-opinion.md +5 -0
  100. package/templates/skills/ctxr-submit.md +28 -4
@@ -0,0 +1,108 @@
1
+ Research a question against real sources and land what you find in this store. The method is a grounded
2
+ adaptation of Stanford's STORM: question the topic from several perspectives, ground each one in sources,
3
+ reconcile what they disagree on, and review the result before anyone acts on it. Grounding beats fluency: every
4
+ load-bearing claim traces to a source of adequate tier, and a confident sentence with nothing behind it is the
5
+ failure this procedure exists to catch.
6
+
7
+ ## When
8
+
9
+ Use it when the operator asks to research, investigate, compare, or map something and the answer should rest on
10
+ outside sources. For a single fact, fetch it and stop. For a question the store already answers, retrieve it
11
+ (AGENTS.md's retrieval section) instead.
12
+
13
+ ## 1. Frame
14
+
15
+ 1. **What the store already knows.** First check the harness's connected meeting and note sources for primary
16
+ material on the topic that was never captured, and capture it (`ctxr-capture`): it is the cheapest evidence
17
+ the pass will get. Then retrieve: the catalog section (`ctxr catalog show --section <id>`), the graph around
18
+ the nearest note (`ctxr context gather --seed <path> --hops 2`), and your own search for literals. Read the
19
+ cluster. What is known, and what is missing, decides whether this ends as a new note or an edit.
20
+ 2. **One scoping question, then commit.** A research question is nearly always under-specified: the lens, the
21
+ depth, where the result goes, the constraints. If it is ambiguous, ask one question with up to four explicit
22
+ options and a stated default, then start. Never make the operator pre-decide six dimensions.
23
+
24
+ ## 2. Perspectives
25
+
26
+ The quality of research is set by the questions asked, and one viewpoint asks a narrow set. Pick at most three
27
+ angles that fit the topic, plus the basic facts. A starter set — swap in others (the regulator, the operator, the
28
+ competitor) when the topic calls for them:
29
+
30
+ - **Practitioner** — what does daily use reveal that theory misses?
31
+ - **Academic** — what does the peer-reviewed evidence say, and where does it contradict popular belief?
32
+ - **Skeptic** — what is the strongest counterargument, and what do proponents ignore?
33
+ - **Economist** — who profits from the current narrative, and what incentives shape it?
34
+ - **Historian** — what parallels exist, and how did they play out?
35
+
36
+ A perspective you name and then cannot source — the fetch failed, the source is paywalled, no primary exists —
37
+ is reported as unsourced, and the findings that lean on it are downgraded. A named angle that was never grounded
38
+ makes single-source research look multi-perspective.
39
+
40
+ ## 3. Search with what the harness has
41
+
42
+ Never search with the raw question. Turn each angle's questions into two or three search-box queries: strip the
43
+ conversational framing ("how does X compare to Y" becomes `X vs Y benchmark`, `X limitations`), add operators
44
+ that favour primary sources (`site:`, `filetype:pdf`, an exact phrase, a year), and run a query two
45
+ angles both need once.
46
+
47
+ Web access differs by harness and by machine — one has a native search tool, another a browser reached through
48
+ its own route, another nothing. Use what this harness provides. When the store documents its own browser
49
+ routing (a store skill or convention), follow it. When the harness can reach no web source at all, say so and
50
+ stop: research filled in from memory is the failure mode, not a fallback.
51
+
52
+ When a fetch comes back empty: official sites often refuse a plain fetch or build their body with JavaScript —
53
+ use a browser, or a static mirror of the same text; a site behind a bot wall that refuses both is a gap to
54
+ report, not to work around. Save a raw API or search response to `__SCRATCH_PATH__` before parsing it, and confirm a
55
+ surprising result with a second, independent query: a parsed response can look authoritative and be wrong. Keep
56
+ the fetched corpus there too, so a follow-up pass re-reads rather than re-fetches.
57
+
58
+ ## 4. Tier the sources
59
+
60
+ Read in tier order, and never let a lower tier carry a decision alone.
61
+
62
+ - **Primary** — filings, official documentation, the paper or repository itself, first-party data, named
63
+ on-record statements, preprint servers, structured company and market databases.
64
+ - **Secondary** — reputable press and analysts. Weight pure opinion down.
65
+ - **Weak** — vendor marketing, content farms, listicles, undated posts, review aggregators, a single social
66
+ post. Signal only.
67
+ - **Unreliable** — sources known for fabrication. Dropped.
68
+
69
+ ## 5. Map the contradictions
70
+
71
+ STORM grounds a claim in sources but never reconciles them. Before synthesizing:
72
+
73
+ - **Direct contradictions** — record both claims with their dates and tiers. Recency and tier break most ties;
74
+ when they do not, carry the conflict as an open question.
75
+ - **Perspective tension** — angles that reached different conclusions. The tension is often the finding.
76
+ - **Source bias transfer** — a load-bearing claim resting on a weak, partisan, or vendor source, or an apparent
77
+ consensus whose sources all trace to one origin. Require an independent primary source for anything
78
+ decision-critical; label vendor and partisan sources inline.
79
+ - **Over-association** — a claim connecting two facts that no single source connects, or one that traces to no
80
+ source at all. Cut it, or mark it as inferred.
81
+ - **The blind spot** — what no perspective and no source addressed. Often the most valuable finding.
82
+
83
+ ## 6. Synthesize
84
+
85
+ Draft the structure from what you know, then refine it against the sources: knowledge for the shape, evidence for
86
+ the content. Resolved tensions become findings; unresolved ones become open questions. Then judge against the
87
+ store: what the research confirms, extends, contradicts, or nuances in the notes you read in step 1.
88
+
89
+ ## 7. Review before anyone acts on it
90
+
91
+ - **Gap pass** — what did the material raise that no angle answered? Those are the open questions.
92
+ - **Self-review against step 5** — did synthesis drop an unresolved tension, promote an inferred claim to fact,
93
+ or lean on an unsourced perspective? Re-run the bias and over-association checks on the finished text: writing
94
+ prose invents connective tissue, and a link that felt natural to write is where over-association hides.
95
+ - **Score each key finding** by the tier behind it, not its tone, and re-verify, downgrade, or flag the weakest.
96
+ - **For findings someone will act on**, or that contradict the store's current view, get a model-diverse review
97
+ (`ctxr-second-opinion`) and treat its dissent as another source, not a vote.
98
+
99
+ ## 8. Land it
100
+
101
+ When the result belongs in the store, `ctxr-ingest-orchestration` decides how it lands — new note, update,
102
+ merge, restructure, or a section — and its thesis-change rule applies when the research overturns an existing
103
+ conclusion. `ctxr-placement` chooses the folder and template. Capture a source through `ctxr-capture` when a
104
+ decision rests on its content, so the evidence outlives the link; otherwise cite it with its tier and the date
105
+ you read it. A chat-only answer says so and files nothing.
106
+
107
+ Report what the research found, its open questions, and which notes it touched, and record a pass that filed
108
+ notes in the store log at `__LOG_PATH__`.
@@ -13,6 +13,11 @@ what it reviews. Weighing the answers is your job, and steps 4 and 5 are how.
13
13
  - **Poll** when the question is *which of these is better?* and being wrong costs mild regret: a name, a
14
14
  framing, a piece of copy, which of several tools fits. If all three agreeing would settle it, it is a poll.
15
15
  If you would still want each reviewer's top objections and a suggested edit, it is a critique.
16
+ A critique is required, not optional, before implementing a change that is architectural, irreversible, or touches
17
+ what may be disclosed and to whom — run it on the written plan before the work, never as a justification after it.
18
+ Its verdict, and the reasoning behind the option chosen, land in the pull request's body: for a structural change
19
+ the pull request and its commit are the decision record, and there is no separate governance step.
20
+
16
21
  - **Answer directly** when there is one right answer, when the operator has already decided and wants
17
22
  confirmation, or when the work is read-only investigation.
18
23
 
@@ -23,13 +23,25 @@ pull request?" — needing to ask is itself the answer: leave, and let the work
23
23
  Ending a turn without that signal is normal and is not this skill. Say in one line what is uncommitted
24
24
  and which worktree holds it, then stop. The work is safe on the branch and the next message picks it up.
25
25
 
26
+ ## Routes
27
+
28
+ Every pull request takes one of three routes. Say which, and why, in its body:
29
+
30
+ - **Session** (the default): the session's work plus the capture it approved.
31
+ - **Own**: a new skill, a structural change (folders, the entry document, conventions), or a refactor touching five
32
+ or more files — reviewed on its own so it is not buried in content.
33
+ - **Housekeeping**: small appends nothing else depends on (a log line, a stray link fix), batched rather than folded
34
+ into unrelated work.
35
+
26
36
  ## Steps
27
37
 
28
38
  1. Re-scan (mandatory — never replay a plan from an earlier snapshot): `git fetch origin`,
29
39
  `git status --short`, `git diff --stat`, `git diff --cached --stat`,
30
40
  `git ls-files --others --exclude-standard`, `git log --oneline origin/__DEFAULT_BRANCH__..HEAD`. State moves
31
41
  under you while you work; name the delta from the previous scan rather than silently folding new work
32
- into old buckets.
42
+ into old buckets. If the session touched or linked to an entity note, run `ctxr rollup stale --for <entity>`
43
+ (or a plain `ctxr rollup stale` when unsure which), and offer `ctxr-rollup` on anything flagged — never run a
44
+ rollup unasked; the operator decides.
33
45
  2. Capture pass: run `ctxr-session-capture` exactly once here — closing a session is itself a capture
34
46
  trigger; do not fire it again after submitting.
35
47
  3. Stage surgically: `git add <paths>`, never `git add -A`; confirm with `git status --short` that the
@@ -39,11 +51,23 @@ and which worktree holds it, then stop. The work is safe on the branch and the n
39
51
  5. Validate: run `ctxr doctor` (store scope, not `--staged` — a session's job is to leave the whole store
40
52
  healthy, not merely pass one commit's gate). Fix a failure; never bypass it, and never proceed past it.
41
53
  6. Commit: `git commit -m "<message>"`, describing the unit staged in step 3.
42
- 7. Name the branch: if it still carries a generated name, `git branch -m "<name>"` before pushing — never
54
+ 7. Name the branch: `<prefix>/<short-slug>`, with a prefix from `skill/` `feat/` `project/` `notes/` `chore/`
55
+ `refactor/` `fix/` unless this store's conventions say otherwise. If it still carries a generated name,
56
+ `git branch -m "<name>"` before pushing — never
43
57
  let a generated name reach the forge. A name given at `ctxr session start` does not settle this: it
44
58
  named a worktree when the work began, and what ships is decided here.
45
- 8. Run: `git push -u origin "<branch>"`, then `gh pr create --base __DEFAULT_BRANCH__ --title "<title>" --body
46
- "<why / what changed / verification / follow-ups>"`. Do not stop to confirm first — the request to
59
+ 8. Before opening the pull request, run `ctxr publish urls --since origin/__DEFAULT_BRANCH__ --json`. When it
60
+ lists any page, the body gets a **Pages** section: a table with one row per page giving its status, its
61
+ preview address, and its published address — copied from the report, never rebuilt by hand. Mark a moved
62
+ page's old address as one that stops working, and a removed page's the same. Under the table state the
63
+ condition once: a preview resolves only while this pull request is open and the server can see this
64
+ session's worktree, and the published address resolves once the served checkout takes the landed commit.
65
+ When the report carries no preview, leave that column out; when it says no base URL is declared, say the
66
+ addresses are bare routes. When it lists no page, add no section.
67
+ Then run: `git push -u origin "<branch>"`, then `gh pr create --base __DEFAULT_BRANCH__ --title "<title>" --body
68
+ "<why / what changed / route / verification / follow-ups>"`. `gh` authenticates from its own credential
69
+ file: never export or interpolate a token, and never rewrite the origin's URL — it is a credential. The body answers those five questions; write the
70
+ why so a reviewer need not re-derive it. Do not stop to confirm first — the request to
47
71
  submit is the consent for both, and `ctxr doctor` in step 5 is the gate on this path. If `gh` has no
48
72
  reachable GitHub remote for this repository, `git push` still succeeds on its own — report the pushed
49
73
  branch and give the operator the manual pull-request instructions instead of retrying `gh`.