@cohesivity/init 0.4.0 → 0.5.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 +2 -2
  2. package/bin/cli.js +37 -15
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -10,9 +10,9 @@ The command runs once and does three things:
10
10
 
11
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
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.
13
+ 3. **Adds a descriptive pointer** to an existing `AGENTS.md`, `CLAUDE.md`, or `README.md`, so whoever opens this project later — a person or another agent — knows it uses Cohesivity and where to check its backend. It only touches a file that is already there, and creates nothing on its own. The pointer sits between `<!-- BEGIN:cohesivity -->` and `<!-- END:cohesivity -->` markers; delete the block and it will be written again on the next run.
14
14
 
15
- It writes nothing else. It does not touch your README.
15
+ It writes nothing else.
16
16
 
17
17
  Install does nothing. Every effect happens when you run the command, and you can read the script first. There is no `postinstall` hook.
18
18
 
package/bin/cli.js CHANGED
@@ -15,11 +15,13 @@
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
- * 3. If AGENTS.md or CLAUDE.md already exists, add a descriptive pointer to it.
18
+ * 3. If AGENTS.md, CLAUDE.md, or README.md already exists, add a descriptive
19
+ * pointer to it.
19
20
  *
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.
21
+ * It writes nothing else, and it creates none of those three files. The pointer
22
+ * is descriptive rather than promotional — it states where this project's
23
+ * backend state lives, which is what makes it worth carrying in a repo someone
24
+ * else (or some other agent) opens later.
23
25
  *
24
26
  * The first line is the shebang. It tells npx to run this file as a program.
25
27
  */
@@ -37,7 +39,7 @@ const flag = (f) => { const i = argv.indexOf(f); return i >= 0 ? argv[i + 1] : u
37
39
  if (has('--help') || has('-h')) { help(); process.exit(0); }
38
40
 
39
41
  // ── config ──────────────────────────────────────────────────────────────────
40
- const PKG_VERSION = '0.4.0';
42
+ const PKG_VERSION = '0.5.0';
41
43
  const BASE = (flag('--base') || process.env.COHESIVITY_BASE || 'https://cohesivity.ai').replace(/\/+$/, '');
42
44
 
43
45
  // Machine id: one per machine, stored outside any project. A project's
@@ -121,7 +123,7 @@ async function main() {
121
123
  console.log(`\ncohesivity/init v${PKG_VERSION}: setting up (harness: ${HARNESS})${DRY ? ' [dry-run: no changes]' : ''}\n`);
122
124
  await installSkill();
123
125
  await ensureTenant();
124
- augmentAgentsFile();
126
+ augmentProjectFiles();
125
127
  ground();
126
128
  }
127
129
 
@@ -242,7 +244,7 @@ function ensureGitignore() {
242
244
  }
243
245
  }
244
246
 
245
- // ── 3) add a descriptive pointer to an existing AGENTS.md / CLAUDE.md ──────────
247
+ // ── 3) add a descriptive pointer to an existing AGENTS.md / CLAUDE.md / README ─
246
248
  // Describe the platform. Never command the agent. The line states a fact: this
247
249
  // project uses Cohesivity, and the state lives here. Auth stays in .cohesivity
248
250
  // and the skill. An agent without the skill still learns the project uses
@@ -251,13 +253,31 @@ const AGENTS_LINE =
251
253
  `This project uses [Cohesivity](https://cohesivity.ai) for its managed backend. ` +
252
254
  `Credentials and tenant state live in \`.cohesivity\`. Live status is at \`GET ${BASE}/api/status\`.`;
253
255
 
254
- function augmentAgentsFile() {
255
- // Only touch files that already exist. Never create an agent file unprompted.
256
- const targets = ['AGENTS.md', 'CLAUDE.md'].map((f) => join(CWD, f)).filter(existsSync);
257
- if (!targets.length) { log('no AGENTS.md / CLAUDE.md present. Skipping (nothing created)'); return; }
258
- for (const file of targets) {
256
+ // The README is read by whoever opens the repo cold, which is a different
257
+ // audience from an agent already working here: it has no skill installed and no
258
+ // reason yet to trust a dotfile it does not recognise. So this line points at
259
+ // the status endpoint and the docs rather than at .cohesivity. The URL is the
260
+ // public docs page and stays absolute — unlike the API base, it is not
261
+ // something a --base override should repoint.
262
+ const README_LINE =
263
+ `If you are another agent who just picked up this project, you can get the status of its backend ` +
264
+ `using the status endpoint, read more at https://cohesivity.ai/backend-for-ai-agents`;
265
+
266
+ const POINTER_FILES = [
267
+ ['AGENTS.md', AGENTS_LINE],
268
+ ['CLAUDE.md', AGENTS_LINE],
269
+ ['README.md', README_LINE],
270
+ ];
271
+
272
+ function augmentProjectFiles() {
273
+ // Only touch files that already exist. Never create one unprompted.
274
+ const targets = POINTER_FILES
275
+ .map(([name, line]) => [join(CWD, name), line])
276
+ .filter(([file]) => existsSync(file));
277
+ if (!targets.length) { log('no AGENTS.md / CLAUDE.md / README.md present. Skipping (nothing created)'); return; }
278
+ for (const [file, line] of targets) {
259
279
  if (DRY) { act(`add a Cohesivity managed block to ${rel(file)}`); continue; }
260
- upsertManagedBlock(file, AGENTS_LINE);
280
+ upsertManagedBlock(file, line);
261
281
  log(`updated ${rel(file)}`);
262
282
  }
263
283
  }
@@ -282,7 +302,8 @@ function ground() {
282
302
  log(tid ? `ready. tenant ${tid}` : 'ready');
283
303
  console.log(` - Keys are in .cohesivity (gitignored, do not commit).`);
284
304
  console.log(` - Provision a service: POST ${BASE}/api/resources/<name> (Authorization: Bearer <coh_management_key>)`);
285
- console.log(` - Docs: ${BASE}/llms.txt`);
305
+ console.log(` - Per-service docs: ${BASE}/offerings/<name> \u00b7 full reference: ${BASE}/llms.txt`);
306
+ console.log(' - The skill is set up for future sessions. Claude Code auto-loads it if ~/.claude/skills already existed, otherwise restart; Cursor and Codex pick it up on reload/restart.');
286
307
  }
287
308
 
288
309
  function versionOf(md) { return (md.match(/^version:\s*(.+)$/m) || [])[1]?.trim() || null; }
@@ -305,7 +326,8 @@ What it does:
305
326
  1. Installs the Cohesivity agent skill into every known agent skill dir
306
327
  whose harness is present on this machine
307
328
  2. Creates or reuses a project tenant -> ./.cohesivity (gitignored)
308
- 3. Adds a descriptive pointer to an existing AGENTS.md / CLAUDE.md
329
+ 3. Adds a descriptive pointer to an existing AGENTS.md / CLAUDE.md / README.md
330
+ (never creates any of them)
309
331
 
310
332
  Attribution: the tenant-creation call carries a User-Agent of the shape
311
333
  {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.4.0",
3
+ "version": "0.5.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": {