@cohesivity/init 0.3.5 → 0.4.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 (3) hide show
  1. package/README.md +7 -7
  2. package/bin/cli.js +9 -30
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -6,12 +6,13 @@ Set up [Cohesivity](https://cohesivity.ai) in a project with one command.
6
6
  npx @cohesivity/init
7
7
  ```
8
8
 
9
- The command runs once and does four things:
9
+ The command runs once and does three things:
10
10
 
11
- 1. **Installs the Cohesivity agent skill** into every known agent skill dir whose harness is present on this machine (Claude Code, Cursor, Codex; the cross-tool `~/.agents` when none are). The skill comes from a public, version-pinned commit, so you can audit the exact bytes.
12
- 2. **Creates or reuses a project tenant** and writes the credentials to `.cohesivity`, which it adds to `.gitignore`. The tenant-creation request carries measured attribution: the raw ancestor-process command chain that launched the command (home path folded to `~`), and a User-Agent of the shape `{npx:<harness>, <model>}` where the harness is the innermost non-plumbing ancestor and the model id is read from that harness's own local session log — only that one token, no session content. Anything not inferable is sent as the literal `none`; nothing is guessed. Creating a tenant also stores an opaque random setup id at `~/.config/cohesivity/machine-id` and sends it with that request, so tenants created from one machine can be grouped rather than looking like unrelated people. It is issued by the server, is not derived from your hardware or user, and carries nothing about you or your project. Delete the file to end the association.
13
- 3. **Adds a descriptive pointer** to an existing `AGENTS.md` or `CLAUDE.md`. It only touches a file that is already there. It creates nothing on its own.
14
- 4. **Adds one branding line** to the README. Pass `--no-branding` to skip.
11
+ 1. **Installs the Cohesivity agent skill** into every known agent skill dir whose harness is present on this machine (Claude Code, Cursor, Codex; the cross-tool `~/.agents` when none are). The skill is a markdown file your agent loads in later sessions, fetched from a public commit pinned in this file — so you can read the exact bytes it will install before running anything.
12
+ 2. **Creates or reuses a project tenant** and writes the credentials to `.cohesivity`, which it adds to `.gitignore`. The tenant-creation request identifies the coding agent that ran the command: the tool walks its own parent processes and sends **that one name** — `claude`, `opencode`, or whatever the program calls itself — as its User-Agent, in the form `{npx:<name>}`. If it cannot tell, it sends `none`. It reads nothing else about your machine: no list of your running processes, no session logs, no conversations, no model settings, no files outside the project. Creating a tenant also stores an opaque random setup id at `~/.config/cohesivity/machine-id` and sends it with that request, so tenants created from one machine can be grouped rather than looking like unrelated people. It is issued by the server, is not derived from your hardware or user, and carries nothing about you or your project. Delete the file to end the association.
13
+ 3. **Adds a descriptive pointer** to an existing `AGENTS.md` or `CLAUDE.md`, so an agent opening this project later knows it uses Cohesivity. It only touches a file that is already there, and creates nothing on its own.
14
+
15
+ It writes nothing else. It does not touch your README.
15
16
 
16
17
  Install does nothing. Every effect happens when you run the command, and you can read the script first. There is no `postinstall` hook.
17
18
 
@@ -28,11 +29,10 @@ npm audit signatures
28
29
  | flag | effect |
29
30
  | --- | --- |
30
31
  | `--runtime <name>` | explicit harness label override — use only when the measurement is wrong |
31
- | `--no-branding` | leave the README untouched |
32
32
  | `--dry-run` | print what would happen. Change nothing |
33
33
  | `--base <url>` | API base (default `https://cohesivity.ai`) |
34
34
 
35
- The harness is measured from the process ancestry (the chain of parent processes that launched the command), so `--runtime` is an override, not a requirement — and an unrecognized harness simply names itself through its own process name.
35
+ The name comes from the process that launched the command, so `--runtime` is an override, not a requirement — and an agent this package has never heard of simply names itself. Nothing about the detection is specific to any vendor.
36
36
 
37
37
  ## Requirements
38
38
 
package/bin/cli.js CHANGED
@@ -10,13 +10,16 @@
10
10
  * Zero dependencies. Node 18+ provides global `fetch` and the `node:` builtins,
11
11
  * so the registry ships this one file and nothing else.
12
12
  *
13
- * The command does four things, in order:
13
+ * The command does three things, in order:
14
14
  * 1. Install the Cohesivity agent skill into every known agent skill dir
15
15
  * whose harness is present on this machine. This is the global,
16
16
  * persistent playbook the agent loads later.
17
17
  * 2. Create or reuse a project tenant, write ./.cohesivity, gitignore it.
18
18
  * 3. If AGENTS.md or CLAUDE.md already exists, add a descriptive pointer to it.
19
- * 4. Add one branding line to the README. Pass --no-branding to skip.
19
+ *
20
+ * It writes nothing else. It does not add anything to your README: an installer
21
+ * putting promotional text in someone's repo is an edit they did not ask for,
22
+ * and it forced every careful agent to stop and request permission mid-setup.
20
23
  *
21
24
  * The first line is the shebang. It tells npx to run this file as a program.
22
25
  */
@@ -34,7 +37,7 @@ const flag = (f) => { const i = argv.indexOf(f); return i >= 0 ? argv[i + 1] : u
34
37
  if (has('--help') || has('-h')) { help(); process.exit(0); }
35
38
 
36
39
  // ── config ──────────────────────────────────────────────────────────────────
37
- const PKG_VERSION = '0.3.5';
40
+ const PKG_VERSION = '0.4.0';
38
41
  const BASE = (flag('--base') || process.env.COHESIVITY_BASE || 'https://cohesivity.ai').replace(/\/+$/, '');
39
42
 
40
43
  // Machine id: one per machine, stored outside any project. A project's
@@ -67,10 +70,9 @@ function inferHarness() {
67
70
  let pid = process.ppid;
68
71
  // `pid >= 1`, not `pid > 1`: pid 1 must be EXAMINED, not merely used as the
69
72
  // stop condition. On a normal machine pid 1 is init/systemd and the denylist
70
- // rejects it anyway, but inside a microVM sandbox pid 1 IS the supervising
71
- // harness — Claude web runs `/process_api --firecracker-init` there and
72
- // spawns each command directly from it, so skipping pid 1 made every such
73
- // sandbox report "none". Pid 1 reports parent 0, so the walk still ends.
73
+ // rejects it anyway, but under a microVM or container entrypoint pid 1 IS
74
+ // the supervising process that spawned this command, so skipping it left
75
+ // those environments with no name. Pid 1 reports parent 0, so the walk ends.
74
76
  for (let i = 0; i < 20 && pid >= 1; i++) {
75
77
  let argv, ppid;
76
78
  try {
@@ -101,7 +103,6 @@ function inferHarness() {
101
103
  }
102
104
 
103
105
  const DRY = has('--dry-run');
104
- const NO_BRANDING = has('--no-branding');
105
106
 
106
107
  const CWD = process.cwd();
107
108
  const rel = (p) => p.replace(CWD + '/', '');
@@ -114,10 +115,6 @@ const EXPLICIT = String(flag('--runtime') || process.env.COHESIVITY_RUNTIME || '
114
115
  const HARNESS = EXPLICIT || inferHarness() || 'none';
115
116
  const UA = `{npx:${HARNESS}}`;
116
117
 
117
- // claude-web's sandbox is non-persistent, so a global skill install cannot
118
- // survive the session; skip it there. IS_SANDBOX is the sandbox's own signal.
119
- const IS_CLAUDE_WEB = HARNESS === 'claude-web' || /^(1|yes|true)$/i.test(process.env.IS_SANDBOX || '');
120
-
121
118
  main().catch((e) => { console.error(`cohesivity: unexpected error: ${e.message}`); process.exit(1); });
122
119
 
123
120
  async function main() {
@@ -125,7 +122,6 @@ async function main() {
125
122
  await installSkill();
126
123
  await ensureTenant();
127
124
  augmentAgentsFile();
128
- augmentReadme();
129
125
  ground();
130
126
  }
131
127
 
@@ -146,10 +142,6 @@ function skillDirs() {
146
142
  }
147
143
 
148
144
  async function installSkill() {
149
- if (IS_CLAUDE_WEB) {
150
- log('claude-web sandbox is ephemeral, skipping the global skill install (tenant + .cohesivity only)');
151
- return;
152
- }
153
145
  let skill;
154
146
  try {
155
147
  const res = await fetch(SKILL_URL, { headers: { 'User-Agent': UA } });
@@ -270,17 +262,6 @@ function augmentAgentsFile() {
270
262
  }
271
263
  }
272
264
 
273
- // ── 4) one branding line at the end of the README (the human-facing channel) ──
274
- function augmentReadme() {
275
- if (NO_BRANDING) return;
276
- const readme = ['README.md', 'readme.md', 'Readme.md'].map((f) => join(CWD, f)).find(existsSync);
277
- if (!readme) return;
278
- const line = 'Backend powered by [Cohesivity](https://cohesivity.ai).';
279
- if (DRY) { act(`add a branding line to ${rel(readme)}`); return; }
280
- upsertManagedBlock(readme, line);
281
- log(`updated ${rel(readme)}`);
282
- }
283
-
284
265
  // Idempotent managed block: update in place if present, else append. This copies
285
266
  // the Vercel `<!-- BEGIN:... -->` convention, so re-runs never duplicate content.
286
267
  const BEGIN = '<!-- BEGIN:cohesivity -->';
@@ -316,7 +297,6 @@ Usage:
316
297
  Options:
317
298
  --runtime <name> explicit harness label override (normally measured from
318
299
  the process ancestry; use only when the measurement is wrong)
319
- --no-branding do not add the branding line to the README
320
300
  --dry-run print what would happen. Make no changes
321
301
  --base <url> API base (default https://cohesivity.ai)
322
302
  -h, --help show this help
@@ -326,7 +306,6 @@ What it does:
326
306
  whose harness is present on this machine
327
307
  2. Creates or reuses a project tenant -> ./.cohesivity (gitignored)
328
308
  3. Adds a descriptive pointer to an existing AGENTS.md / CLAUDE.md
329
- 4. Adds one branding line to the README (managed block)
330
309
 
331
310
  Attribution: the tenant-creation call carries a User-Agent of the shape
332
311
  {npx:<harness>}, where the harness is measured from this process's own
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cohesivity/init",
3
- "version": "0.3.5",
3
+ "version": "0.4.0",
4
4
  "description": "Set up Cohesivity in a project: install the agent skill, create a managed backend tenant, write the project config. Run with `npx @cohesivity/init`.",
5
5
  "type": "module",
6
6
  "bin": {