@intentic/claude-plugin 1.317.0 → 1.319.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.
@@ -793,12 +793,6 @@ var OPTIONS = {
793
793
  description: "Let Claude read documents, PDFs, spreadsheets, slides, notebooks, images, audio and archives as markdown with the bundled `fileq` CLI. Off makes the command refuse; its one-line skill description stays listed, since a plugin cannot hide its own skills.",
794
794
  default: true
795
795
  },
796
- shadows: {
797
- type: "boolean",
798
- title: "Document shadows",
799
- description: "Keep a markdown rendering of every document in the project up to date in the background (a sweep at session start and every ten minutes, and each binary file Claude writes), so a read finds one ready. Costs background CPU on a document-heavy project.",
800
- default: false
801
- },
802
796
  holdout: {
803
797
  type: "number",
804
798
  title: "Measured share",
@@ -2,13 +2,10 @@ import { createRequire as __intenticRequire } from 'node:module'; const require
2
2
 
3
3
  // src/prompt-submit.ts
4
4
  import { spawnSync } from "node:child_process";
5
- import { existsSync } from "node:fs";
6
5
 
7
6
  // src/runtime.ts
8
- import { spawn } from "node:child_process";
9
7
  import { accessSync, closeSync, constants, mkdirSync, openSync, readFileSync, statSync, writeFileSync } from "node:fs";
10
8
  import { delimiter, dirname, join } from "node:path";
11
- var pluginRoot = (env = process.env) => env["CLAUDE_PLUGIN_ROOT"] ?? dirname(import.meta.dirname);
12
9
  var onPath = (name, env = process.env) => {
13
10
  const extensions = process.platform === "win32" ? (env["PATHEXT"] ?? ".EXE;.CMD;.BAT").split(";") : [""];
14
11
  for (const dir of (env["PATH"] ?? "").split(delimiter)) {
@@ -22,36 +19,6 @@ var onPath = (name, env = process.env) => {
22
19
  }
23
20
  return false;
24
21
  };
25
- var startDetached = (command, args, options) => {
26
- mkdirSync(dirname(options.log), { recursive: true });
27
- const out = openSync(options.log, "w");
28
- try {
29
- const child = spawn(command, args, { cwd: options.cwd, detached: true, stdio: ["ignore", out, out], env: { ...options.env ?? process.env } });
30
- child.on("error", () => void 0);
31
- child.unref();
32
- } finally {
33
- closeSync(out);
34
- }
35
- };
36
- var claimIfDue = (stamp, everyMs, now = Date.now()) => {
37
- try {
38
- if (now - statSync(stamp).mtimeMs < everyMs) {
39
- return false;
40
- }
41
- } catch {
42
- }
43
- try {
44
- mkdirSync(dirname(stamp), { recursive: true });
45
- writeFileSync(stamp, `${now}
46
- `);
47
- return true;
48
- } catch (error) {
49
- process.stderr.write(`intentic: ${stamp} cannot be written (${error instanceof Error ? error.message : String(error)}), so what it paces is skipped
50
- `);
51
- return false;
52
- }
53
- };
54
- var projectSlug = (project) => project.replace(/[^a-zA-Z0-9]/g, "-");
55
22
 
56
23
  // src/features.ts
57
24
  var OPTIONS = {
@@ -99,12 +66,6 @@ var OPTIONS = {
99
66
  description: "Let Claude read documents, PDFs, spreadsheets, slides, notebooks, images, audio and archives as markdown with the bundled `fileq` CLI. Off makes the command refuse; its one-line skill description stays listed, since a plugin cannot hide its own skills.",
100
67
  default: true
101
68
  },
102
- shadows: {
103
- type: "boolean",
104
- title: "Document shadows",
105
- description: "Keep a markdown rendering of every document in the project up to date in the background (a sweep at session start and every ten minutes, and each binary file Claude writes), so a read finds one ready. Costs background CPU on a document-heavy project.",
106
- default: false
107
- },
108
69
  holdout: {
109
70
  type: "number",
110
71
  title: "Measured share",
@@ -145,8 +106,6 @@ var readOptions = (env = process.env) => {
145
106
  };
146
107
 
147
108
  // src/hook-io.ts
148
- import { homedir } from "node:os";
149
- import { join as join2 } from "node:path";
150
109
  var readStdin = async () => {
151
110
  const chunks = [];
152
111
  for await (const chunk of process.stdin) {
@@ -181,35 +140,15 @@ var runHook = async (handle) => {
181
140
  `);
182
141
  }
183
142
  };
184
- var dataDir = (env = process.env) => env["CLAUDE_PLUGIN_DATA"] ?? join2(env["CLAUDE_CONFIG_DIR"] ?? join2(homedir(), ".claude"), "plugins", "data", "intentic-intentic");
185
143
  var projectDir = (input, env = process.env) => env["CLAUDE_PROJECT_DIR"] ?? input.cwd ?? process.cwd();
186
144
 
187
- // src/shadows.ts
188
- import { relative, isAbsolute, join as join3 } from "node:path";
189
- var SWEEP_EVERY_MS = 10 * 6e4;
190
- var fileq = (env) => join3(pluginRoot(env), "dist", "fileq.mjs");
191
- var logOf = (data, project, what) => join3(data, "shadows", `${projectSlug(project)}.${what}.log`);
192
- var fileqEnv = (env, project) => ({ ...env, WORKSPACE_ROOT: project });
193
- var sweepIfDue = (data, project, env = process.env, now = Date.now()) => {
194
- if (!claimIfDue(join3(data, "shadows", `${projectSlug(project)}.stamp`), SWEEP_EVERY_MS, now)) {
195
- return false;
196
- }
197
- startDetached(process.execPath, [fileq(env), "sweep", "--json"], { cwd: project, log: logOf(data, project, "sweep"), env: fileqEnv(env, project) });
198
- return true;
199
- };
200
-
201
145
  // src/prompt-submit.ts
202
146
  var MATCH_TIMEOUT_MS = 8e3;
203
147
  var promptSubmit = (input, raw, env = process.env) => {
204
- const options = readOptions(env);
205
- const project = projectDir(input, env);
206
- if (options.shadows && existsSync(project)) {
207
- sweepIfDue(dataDir(env), project, env);
208
- }
209
- if (!options.iq || !onPath("iq", env)) {
148
+ if (!readOptions(env).iq || !onPath("iq", env)) {
210
149
  return void 0;
211
150
  }
212
- const match = spawnSync("iq", ["sessions", "match", "--hook"], { cwd: project, input: raw, encoding: "utf8", timeout: MATCH_TIMEOUT_MS, env: { ...env } });
151
+ const match = spawnSync("iq", ["sessions", "match", "--hook"], { cwd: projectDir(input, env), input: raw, encoding: "utf8", timeout: MATCH_TIMEOUT_MS, env: { ...env } });
213
152
  return match.status === 0 && typeof match.stdout === "string" && match.stdout.trim() !== "" ? match.stdout : void 0;
214
153
  };
215
154
  if (process.argv[1]?.endsWith("prompt-submit.mjs")) {
@@ -837,8 +837,8 @@ var require_ignore = __commonJS({
837
837
  });
838
838
 
839
839
  // src/session-start.ts
840
- import { appendFileSync as appendFileSync2, existsSync } from "node:fs";
841
- import { join as join7 } from "node:path";
840
+ import { appendFileSync as appendFileSync2 } from "node:fs";
841
+ import { join as join6 } from "node:path";
842
842
 
843
843
  // ../agent-context/src/field-notes.ts
844
844
  import { createHash } from "node:crypto";
@@ -1395,12 +1395,6 @@ var OPTIONS = {
1395
1395
  description: "Let Claude read documents, PDFs, spreadsheets, slides, notebooks, images, audio and archives as markdown with the bundled `fileq` CLI. Off makes the command refuse; its one-line skill description stays listed, since a plugin cannot hide its own skills.",
1396
1396
  default: true
1397
1397
  },
1398
- shadows: {
1399
- type: "boolean",
1400
- title: "Document shadows",
1401
- description: "Keep a markdown rendering of every document in the project up to date in the background (a sweep at session start and every ten minutes, and each binary file Claude writes), so a read finds one ready. Costs background CPU on a document-heavy project.",
1402
- default: false
1403
- },
1404
1398
  holdout: {
1405
1399
  type: "number",
1406
1400
  title: "Measured share",
@@ -1527,20 +1521,6 @@ var recordSession = (data, row) => {
1527
1521
  `);
1528
1522
  };
1529
1523
 
1530
- // src/shadows.ts
1531
- import { relative as relative2, isAbsolute, join as join6 } from "node:path";
1532
- var SWEEP_EVERY_MS = 10 * 6e4;
1533
- var fileq = (env) => join6(pluginRoot(env), "dist", "fileq.mjs");
1534
- var logOf = (data, project, what) => join6(data, "shadows", `${projectSlug(project)}.${what}.log`);
1535
- var fileqEnv = (env, project) => ({ ...env, WORKSPACE_ROOT: project });
1536
- var sweepIfDue = (data, project, env = process.env, now = Date.now()) => {
1537
- if (!claimIfDue(join6(data, "shadows", `${projectSlug(project)}.stamp`), SWEEP_EVERY_MS, now)) {
1538
- return false;
1539
- }
1540
- startDetached(process.execPath, [fileq(env), "sweep", "--json"], { cwd: project, log: logOf(data, project, "sweep"), env: fileqEnv(env, project) });
1541
- return true;
1542
- };
1543
-
1544
1524
  // src/session-start.ts
1545
1525
  var NOTES_BUDGET = 4e3;
1546
1526
  var NOTICE_EVERY_MS = 24 * 60 * 6e4;
@@ -1550,7 +1530,7 @@ var compose = (options, input, project, arms, data, env) => {
1550
1530
  const context = [];
1551
1531
  const notices = [];
1552
1532
  const notice = (id, text) => {
1553
- if (claimIfDue(join7(data, "notices", `${id}.stamp`), NOTICE_EVERY_MS)) {
1533
+ if (claimIfDue(join6(data, "notices", `${id}.stamp`), NOTICE_EVERY_MS)) {
1554
1534
  notices.push(text);
1555
1535
  }
1556
1536
  };
@@ -1590,7 +1570,7 @@ var compose = (options, input, project, arms, data, env) => {
1590
1570
  ${nudge.trim()}`);
1591
1571
  sent.iq = true;
1592
1572
  }
1593
- startDetached("iq", ["sessions", "ingest"], { cwd: project, log: join7(data, "iq", `${projectSlug(project)}.ingest.log`), env });
1573
+ startDetached("iq", ["sessions", "ingest"], { cwd: project, log: join6(data, "iq", `${projectSlug(project)}.ingest.log`), env });
1594
1574
  } else {
1595
1575
  notice("iq-missing", "intentic: iq search is on but the `iq` CLI is not installed (`npm i -g @intentic/iq`), so nothing was taught.");
1596
1576
  }
@@ -1622,9 +1602,6 @@ var sessionStart = (input, env = process.env) => {
1622
1602
  const source = input.source ?? "startup";
1623
1603
  record("the switches", () => saveOptions(data, options));
1624
1604
  exportEnv(options, project, env);
1625
- if (options.shadows && existsSync(project)) {
1626
- sweepIfDue(data, project, env);
1627
- }
1628
1605
  if (!TOLD_ON.has(source)) {
1629
1606
  return void 0;
1630
1607
  }
package/dist/stats.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __intenticRequire } from 'node:module'; const require = __intenticRequire(import.meta.url);
2
2
 
3
3
  // src/stats.ts
4
- import { readdirSync as readdirSync3, readFileSync as readFileSync5 } from "node:fs";
4
+ import { readFileSync as readFileSync5 } from "node:fs";
5
5
  import { join as join8 } from "node:path";
6
6
 
7
7
  // ../agent-context/src/arm-stats.ts
@@ -21,6 +21,13 @@ var armOfValues = (values) => {
21
21
  const variance = values.length < 2 ? 0 : values.reduce((sum2, value) => sum2 + (value - mean) ** 2, 0) / (values.length - 1);
22
22
  return { turns: values.length, mean, variance };
23
23
  };
24
+ var CAP_QUANTILE = 0.95;
25
+ var capped = (on, off) => {
26
+ const pooled = [...on, ...off].toSorted((left, right) => left - right);
27
+ const cap = pooled[Math.min(pooled.length - 1, Math.floor(CAP_QUANTILE * pooled.length))] ?? 0;
28
+ const bound = (values) => values.map((value) => Math.min(value, cap));
29
+ return { on: bound(on), off: bound(off) };
30
+ };
24
31
  var RESOLVING_MARGIN_PCT = 10;
25
32
  var controlTurnsNeededFor = (offTurns, marginPct) => {
26
33
  if (marginPct <= RESOLVING_MARGIN_PCT) {
@@ -96,7 +103,8 @@ var measureExperiment = (turns, design) => {
96
103
  const value = sample.arm === arm ? design.sample(sample.turns, metric) : void 0;
97
104
  return value === void 0 ? [] : [value];
98
105
  });
99
- return readingOfArms(armOfValues(values(true)), armOfValues(values(false)), metric, false);
106
+ const arms = capped(values(true), values(false));
107
+ return readingOfArms(armOfValues(arms.on), armOfValues(arms.off), metric, false);
100
108
  };
101
109
  const [headline, ...rest] = design.metrics;
102
110
  return {
@@ -463,27 +471,6 @@ var readClaudeSession = (file, options) => {
463
471
  return session;
464
472
  };
465
473
 
466
- // ../../_tools/base/src/outside-text.ts
467
- var CONTROL_TAGS = ["system-reminder", "task-notification", "command-name", "command-message", "command-args", "local-command-stdout"];
468
- var CONTROL = new RegExp(String.raw`<\s*/?\s*(?:${CONTROL_TAGS.join("|")})\b[^>]*>`, "gi");
469
-
470
- // ../../_tools/constants/src/hosted-tiers.ts
471
- var HOSTED_TIERS = [
472
- { id: "free", name: "Free", cpuKind: "shared", cpus: 4, memoryMb: 4096, volumeGb: 10, monthlyHours: 40, priceUsd: 0, flyHourUsd: 0.0329 },
473
- { id: "standard", name: "Standard", cpuKind: "shared", cpus: 8, memoryMb: 8192, volumeGb: 25, monthlyHours: 220, priceUsd: 20, flyHourUsd: 0.0657 },
474
- { id: "max", name: "Max", cpuKind: "shared", cpus: 8, memoryMb: 16384, volumeGb: 50, monthlyHours: 320, priceUsd: 50, flyHourUsd: 0.1234 }
475
- ];
476
- var FREE_TIER = HOSTED_TIERS[0];
477
- var PAID_TIERS = HOSTED_TIERS.filter((tier) => tier.priceUsd > 0);
478
-
479
- // ../../_tools/constants/src/index.ts
480
- var STATE_DIR = ".intentic";
481
- var GOOGLE_CLIENT_ID = "481795963975-cq9msl6higcd91joidrfp8mjlkuq5fk3.apps.googleusercontent.com";
482
- var GOOGLE_TOKEN_STORAGE_KEY = `intentic.gid.${GOOGLE_CLIENT_ID}`;
483
-
484
- // ../fileq/src/lib/sidecar.ts
485
- var DERIVED_DIR = `${STATE_DIR}/local/cache/derived`;
486
-
487
474
  // ../agent-context/src/turn-metrics.ts
488
475
  var createTurnMetrics = (root) => {
489
476
  let calls = 0;
@@ -666,7 +653,6 @@ var isMissing2 = (error) => {
666
653
  const code = typeof error === "object" && error !== null ? error.code : void 0;
667
654
  return code === "ENOENT" || code === "ENOTDIR";
668
655
  };
669
- var projectSlug = (project) => project.replace(/[^a-zA-Z0-9]/g, "-");
670
656
 
671
657
  // src/features.ts
672
658
  var OPTIONS = {
@@ -714,12 +700,6 @@ var OPTIONS = {
714
700
  description: "Let Claude read documents, PDFs, spreadsheets, slides, notebooks, images, audio and archives as markdown with the bundled `fileq` CLI. Off makes the command refuse; its one-line skill description stays listed, since a plugin cannot hide its own skills.",
715
701
  default: true
716
702
  },
717
- shadows: {
718
- type: "boolean",
719
- title: "Document shadows",
720
- description: "Keep a markdown rendering of every document in the project up to date in the background (a sweep at session start and every ten minutes, and each binary file Claude writes), so a read finds one ready. Costs background CPU on a document-heavy project.",
721
- default: false
722
- },
723
703
  holdout: {
724
704
  type: "number",
725
705
  title: "Measured share",
@@ -1244,9 +1224,9 @@ var cleanSucceeded = (lines, command, enabled, ran) => {
1244
1224
  out = ran("wide", elideWideRuns(out));
1245
1225
  }
1246
1226
  if (enabled.has("cap")) {
1247
- const capped = capOutput(out, command);
1248
- if (capped !== out) {
1249
- out = ran("cap", capped);
1227
+ const capped2 = capOutput(out, command);
1228
+ if (capped2 !== out) {
1229
+ out = ran("cap", capped2);
1250
1230
  }
1251
1231
  }
1252
1232
  return out;
@@ -1750,48 +1730,6 @@ var mechanismLine = (title, reads, on, experiment, holdout) => {
1750
1730
  }
1751
1731
  return `${title}, ${reads}: ${readingLine(experiment.metrics[0], experiment.sampleUnit ?? "conversations")}`;
1752
1732
  };
1753
- var countShadows = (dir) => {
1754
- let count = 0;
1755
- const walk = (current) => {
1756
- let entries;
1757
- try {
1758
- entries = readdirSync3(current, { withFileTypes: true });
1759
- } catch (error) {
1760
- if (isMissing2(error)) {
1761
- return;
1762
- }
1763
- throw error;
1764
- }
1765
- for (const entry of entries) {
1766
- if (entry.isDirectory()) {
1767
- walk(join8(current, entry.name));
1768
- } else if (entry.name.endsWith(".md")) {
1769
- count += 1;
1770
- }
1771
- }
1772
- };
1773
- walk(dir);
1774
- return count;
1775
- };
1776
- var lastSweep = (data, project) => {
1777
- const text = readText(join8(data, "shadows", `${projectSlug(project)}.sweep.log`));
1778
- try {
1779
- const summary = JSON.parse(text ?? "");
1780
- return typeof summary.derived === "number" && typeof summary.fresh === "number" ? ` (last sweep: ${summary.derived} derived, ${summary.fresh} already fresh${typeof summary.pruned === "number" && summary.pruned > 0 ? `, ${summary.pruned} pruned` : ""})` : "";
1781
- } catch {
1782
- return "";
1783
- }
1784
- };
1785
- var shadowLine = (args) => {
1786
- if (!args.options.shadows) {
1787
- return "Document shadows: switched off.";
1788
- }
1789
- if (args.project === void 0) {
1790
- return "Document shadows: reported per project.";
1791
- }
1792
- const count = countShadows(join8(args.project, DERIVED_DIR));
1793
- return `Document shadows: ${count} documents have a markdown shadow${lastSweep(args.data, args.project)}. Nothing measures what they save yet.`;
1794
- };
1795
1733
  var inScope = (args, project) => args.project === void 0 || project === args.project;
1796
1734
  var statsReport = (args) => {
1797
1735
  const rows = parseStatsFile(readText(join8(outputDir(args.data), "filter-stats.jsonl")) ?? "").filter((row) => inScope(args, row.project));
@@ -1810,8 +1748,6 @@ var statsReport = (args) => {
1810
1748
  ...DESIGNS.map(
1811
1749
  ({ title, option, design, reads }) => mechanismLine(title, reads, args.options[option] === true, measureExperiment(turns, design), args.options.holdout)
1812
1750
  ),
1813
- ``,
1814
- shadowLine(args),
1815
1751
  ``
1816
1752
  ].join("\n");
1817
1753
  };
@@ -0,0 +1,208 @@
1
+ NOTICE
2
+ ======
3
+
4
+ fileq is part of the Intentic repository and is MIT-licensed (package.json).
5
+ It includes material adapted from SurfSense, which is covered below.
6
+
7
+
8
+ SurfSense
9
+ ---------
10
+
11
+ Copyright (c) SurfSense
12
+ https://github.com/MODSetter/SurfSense (read at a51f9a367ccafe873d7d85a4f3878e5a6de4e662)
13
+
14
+ The adapted material comes from the parts of SurfSense licensed under the
15
+ Apache License, Version 2.0; its full text follows. SurfSense ships no NOTICE
16
+ file of its own. Each adapted file says in its header what it took and what it
17
+ changed:
18
+
19
+ src/skill-authoring.ts authoring rules, from
20
+ docker/sandbox/skills/{pptx,docx,xlsx,pdf}/SKILL.md
21
+ src/lib/check/pptx.ts geometry, crop and missing-media rules, from
22
+ surfsense_backend/app/artifacts/verification/formats/pptx.py
23
+ src/lib/check/docx.ts the literal-bullet rule, from .../formats/docx.py
24
+ src/lib/check/xlsx.ts error-value and missing-cached-value rules, from
25
+ .../formats/xlsx.py
26
+ src/lib/check/pdf.ts blank-page and unembedded-font rules, from
27
+ .../formats/pdf.py
28
+
29
+ The code in those files is written for fileq, in TypeScript; what it carries
30
+ over is the rules, their thresholds and the wording of the authoring guidance.
31
+
32
+
33
+ Apache License
34
+ Version 2.0, January 2004
35
+ http://www.apache.org/licenses/
36
+
37
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
38
+
39
+ 1. Definitions.
40
+
41
+ "License" shall mean the terms and conditions for use, reproduction,
42
+ and distribution as defined by Sections 1 through 9 of this document.
43
+
44
+ "Licensor" shall mean the copyright owner or entity authorized by
45
+ the copyright owner that is granting the License.
46
+
47
+ "Legal Entity" shall mean the union of the acting entity and all
48
+ other entities that control, are controlled by, or are under common
49
+ control with that entity. For the purposes of this definition,
50
+ "control" means (i) the power, direct or indirect, to cause the
51
+ direction or management of such entity, whether by contract or
52
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
53
+ outstanding shares, or (iii) beneficial ownership of such entity.
54
+
55
+ "You" (or "Your") shall mean an individual or Legal Entity
56
+ exercising permissions granted by this License.
57
+
58
+ "Source" form shall mean the preferred form for making modifications,
59
+ including but not limited to software source code, documentation
60
+ source, and configuration files.
61
+
62
+ "Object" form shall mean any form resulting from mechanical
63
+ transformation or translation of a Source form, including but
64
+ not limited to compiled object code, generated documentation,
65
+ and conversions to other media types.
66
+
67
+ "Work" shall mean the work of authorship, whether in Source or
68
+ Object form, made available under the License, as indicated by a
69
+ copyright notice that is included in or attached to the work
70
+ (an example is provided in the Appendix below).
71
+
72
+ "Derivative Works" shall mean any work, whether in Source or Object
73
+ form, that is based on (or derived from) the Work and for which the
74
+ editorial revisions, annotations, elaborations, or other modifications
75
+ represent, as a whole, an original work of authorship. For the purposes
76
+ of this License, Derivative Works shall not include works that remain
77
+ separable from, or merely link (or bind by name) to the interfaces of,
78
+ the Work and Derivative Works thereof.
79
+
80
+ "Contribution" shall mean any work of authorship, including
81
+ the original version of the Work and any modifications or additions
82
+ to that Work or Derivative Works thereof, that is intentionally
83
+ submitted to Licensor for inclusion in the Work by the copyright owner
84
+ or by an individual or Legal Entity authorized to submit on behalf of
85
+ the copyright owner. For the purposes of this definition, "submitted"
86
+ means any form of electronic, verbal, or written communication sent
87
+ to the Licensor or its representatives, including but not limited to
88
+ communication on electronic mailing lists, source code control systems,
89
+ and issue tracking systems that are managed by, or on behalf of, the
90
+ Licensor for the purpose of discussing and improving the Work, but
91
+ excluding communication that is conspicuously marked or otherwise
92
+ designated in writing by the copyright owner as "Not a Contribution."
93
+
94
+ "Contributor" shall mean Licensor and any individual or Legal Entity
95
+ on behalf of whom a Contribution has been received by Licensor and
96
+ subsequently incorporated within the Work.
97
+
98
+ 2. Grant of Copyright License. Subject to the terms and conditions of
99
+ this License, each Contributor hereby grants to You a perpetual,
100
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
101
+ copyright license to reproduce, prepare Derivative Works of,
102
+ publicly display, publicly perform, sublicense, and distribute the
103
+ Work and such Derivative Works in Source or Object form.
104
+
105
+ 3. Grant of Patent License. Subject to the terms and conditions of
106
+ this License, each Contributor hereby grants to You a perpetual,
107
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
108
+ (except as stated in this section) patent license to make, have made,
109
+ use, offer to sell, sell, import, and otherwise transfer the Work,
110
+ where such license applies only to those patent claims licensable
111
+ by such Contributor that are necessarily infringed by their
112
+ Contribution(s) alone or by combination of their Contribution(s)
113
+ with the Work to which such Contribution(s) was submitted. If You
114
+ institute patent litigation against any entity (including a
115
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
116
+ or a Contribution incorporated within the Work constitutes direct
117
+ or contributory patent infringement, then any patent licenses
118
+ granted to You under this License for that Work shall terminate
119
+ as of the date such litigation is filed.
120
+
121
+ 4. Redistribution. You may reproduce and distribute copies of the
122
+ Work or Derivative Works thereof in any medium, with or without
123
+ modifications, and in Source or Object form, provided that You
124
+ meet the following conditions:
125
+
126
+ (a) You must give any other recipients of the Work or
127
+ Derivative Works a copy of this License; and
128
+
129
+ (b) You must cause any modified files to carry prominent notices
130
+ stating that You changed the files; and
131
+
132
+ (c) You must retain, in the Source form of any Derivative Works
133
+ that You distribute, all copyright, patent, trademark, and
134
+ attribution notices from the Source form of the Work,
135
+ excluding those notices that do not pertain to any part of
136
+ the Derivative Works; and
137
+
138
+ (d) If the Work includes a "NOTICE" text file as part of its
139
+ distribution, then any Derivative Works that You distribute must
140
+ include a readable copy of the attribution notices contained
141
+ within such NOTICE file, excluding those notices that do not
142
+ pertain to any part of the Derivative Works, in at least one
143
+ of the following places: within a NOTICE text file distributed
144
+ as part of the Derivative Works; within the Source form or
145
+ documentation, if provided along with the Derivative Works; or,
146
+ within a display generated by the Derivative Works, if and
147
+ wherever such third-party notices normally appear. The contents
148
+ of the NOTICE file are for informational purposes only and
149
+ do not modify the License. You may add Your own attribution
150
+ notices within Derivative Works that You distribute, alongside
151
+ or as an addendum to the NOTICE text from the Work, provided
152
+ that such additional attribution notices cannot be construed
153
+ as modifying the License.
154
+
155
+ You may add Your own copyright statement to Your modifications and
156
+ may provide additional or different license terms and conditions
157
+ for use, reproduction, or distribution of Your modifications, or
158
+ for any such Derivative Works as a whole, provided Your use,
159
+ reproduction, and distribution of the Work otherwise complies with
160
+ the conditions stated in this License.
161
+
162
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
163
+ any Contribution intentionally submitted for inclusion in the Work
164
+ by You to the Licensor shall be under the terms and conditions of
165
+ this License, without any additional terms or conditions.
166
+ Notwithstanding the above, nothing herein shall supersede or modify
167
+ the terms of any separate license agreement you may have executed
168
+ with Licensor regarding such Contributions.
169
+
170
+ 6. Trademarks. This License does not grant permission to use the trade
171
+ names, trademarks, service marks, or product names of the Licensor,
172
+ except as required for reasonable and customary use in describing the
173
+ origin of the Work and reproducing the content of the NOTICE file.
174
+
175
+ 7. Disclaimer of Warranty. Unless required by applicable law or
176
+ agreed to in writing, Licensor provides the Work (and each
177
+ Contributor provides its Contributions) on an "AS IS" BASIS,
178
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
179
+ implied, including, without limitation, any warranties or conditions
180
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
181
+ PARTICULAR PURPOSE. You are solely responsible for determining the
182
+ appropriateness of using or redistributing the Work and assume any
183
+ risks associated with Your exercise of permissions under this License.
184
+
185
+ 8. Limitation of Liability. In no event and under no legal theory,
186
+ whether in tort (including negligence), contract, or otherwise,
187
+ unless required by applicable law (such as deliberate and grossly
188
+ negligent acts) or agreed to in writing, shall any Contributor be
189
+ liable to You for damages, including any direct, indirect, special,
190
+ incidental, or consequential damages of any character arising as a
191
+ result of this License or out of the use or inability to use the
192
+ Work (including but not limited to damages for loss of goodwill,
193
+ work stoppage, computer failure or malfunction, or any and all
194
+ other commercial damages or losses), even if such Contributor
195
+ has been advised of the possibility of such damages.
196
+
197
+ 9. Accepting Warranty or Additional Liability. While redistributing
198
+ the Work or Derivative Works thereof, You may choose to offer,
199
+ and charge a fee for, acceptance of support, warranty, indemnity,
200
+ or other liability obligations and/or rights consistent with this
201
+ License. However, in accepting such obligations, You may act only
202
+ on Your own behalf and on Your sole responsibility, not on behalf
203
+ of any other Contributor, and only if You agree to indemnify,
204
+ defend, and hold each Contributor harmless for any liability
205
+ incurred by, or claims asserted against, such Contributor by reason
206
+ of your accepting any such warranty or additional liability.
207
+
208
+ END OF TERMS AND CONDITIONS
@@ -11,7 +11,9 @@ It exists because the project map cannot carry this. The map is recomputed from
11
11
 
12
12
  The evidence is the digest below: this project's own Claude Code sessions, read back and counted by the plugin (failures by how many sessions hit them, the commands that ran and how often they failed, the files edited most, how sessions opened). Open a transcript it names when a count needs its story. Work from counts, not impressions: how MANY sessions hit a thing is what decides its rank, and one bad afternoon is not a standing problem.
13
13
 
14
- Rank by what it costs a turn NOT to know: how often sessions hit it, how much it costs when they do, and whether they could have found it out cheaply themselves. Rank 1 is the costliest gap.
14
+ Rank by what it costs a turn NOT to know: how often sessions hit it, how much it costs when they do, and whether they could have found it out cheaply themselves. Rank 1 is the costliest gap. Rank on recent sessions only, and recount every percentage from them rather than carrying the old one forward: a trap sessions stopped hitting, because the code or the environment has since fixed it, drops down or out however costly it once was.
15
+
16
+ SIZE IS PART OF THE RANKING. The intentic plugin sends the priority table on every turn, then whole sections in rank order until the owner's budget runs out (4,000 characters by default, the table included), and stops at the first section that does not fit, so one long section silences every rank below it. Keep the table's cells to a few words, keep each section under about 700 characters, and split anything longer into two ranks. Leave out what every turn is already told elsewhere (the system prompt's working rules, the skills it lists, the search teaching): repeating it spends the budget twice.
15
17
 
16
18
  VERIFY EVERY FACT AGAINST THIS PROJECT BEFORE YOU WRITE IT DOWN. A transcript from six weeks ago is a hypothesis: run the command, list the directory, check the port. A brief that is confidently wrong is worse than no brief, because every turn reads it and none of them will doubt it.
17
19
 
@@ -1,16 +1,16 @@
1
1
  ---
2
2
  name: fileq
3
- description: Read binary workspace files (docx, odt, xlsx, pptx, pdf, epub, ipynb, images, audio, zip and tar archives, V8 CPU and heap profiles) as clean budgeted markdown with the `fileq` CLI, and read big text-shaped files (csv, json, logs) without flooding your context. Use whenever a task needs the contents of a document, the text layer of a PDF, the metadata of an image or recording, what is inside an archive, or a look inside a file too large to cat — instead of guessing from the filename or shelling out to ad-hoc converters.
3
+ description: Read binary files (docx, xlsx, pptx, pdf, odt, epub, ipynb, images, audio, archives, V8 profiles) as budgeted markdown with `fileq`, size up csv, json or logs too big to cat, and check and render a docx, pptx, xlsx or pdf you made. Use instead of guessing from a filename, ad-hoc converters, or delivering it unseen.
4
4
  ---
5
5
 
6
6
  # fileq: binary files as markdown
7
7
 
8
- The `fileq` CLI (on PATH) turns the workspace files you cannot open as text into markdown, and keeps a
9
- sidecar copy fresh so reading twice derives once.
8
+ The `fileq` CLI (on PATH) turns the workspace files you cannot open as text into markdown. Renderings are
9
+ cached by content, so a repeat read of unchanged content is instant.
10
10
 
11
11
  ## Read a file
12
12
  `fileq <file>` (or `fileq read <file> --budget 8000`)
13
- - Prints a capsule (format, token cost), the content up to the budget, and `saved:` — the sidecar path
13
+ - Prints a capsule (format, token cost), the content up to the budget, and `saved:` — the markdown file
14
14
  carrying the whole thing. Over budget, the cut is announced with that exact path to Read.
15
15
  - Formats: docx and odt (headings, lists, tables), xlsx (capped tables), pptx (slides + speaker notes),
16
16
  pdf (text layer; a scan is OCR'd when `tesseract` is on PATH, and the note says the words are
@@ -22,10 +22,11 @@ sidecar copy fresh so reading twice derives once.
22
22
  compressed file (`server.log.gz`) is the exception and derives to its text, since there the archive is
23
23
  the document. 7z and rar answer that nothing here opens them.
24
24
 
25
- ## Check the sidecar first
26
- A file may already have a shadow at `.intentic/local/cache/derived/<path>.md` — front matter says which
27
- source hash it was derived from. `fileq read` checks freshness for you, so prefer it over trusting a
28
- shadow's age by eye.
25
+ ## Reading again is free
26
+ A rendering is keyed by the file's sha256 and the reader's version, not its path: `fileq read` on an
27
+ unchanged file, a copy or a move of it, or the same bytes downloaded elsewhere answers from the cache
28
+ without parsing it again. Run it again rather than opening a sidecar under `.intentic/local/cache/derived` by hand; it
29
+ checks the hash for you.
29
30
 
30
31
  ## What it refuses, and why
31
32
  - A scanned PDF with no `tesseract` on PATH answers "no usable text layer … OCR is not part of this tier"
@@ -36,6 +37,40 @@ shadow's age by eye.
36
37
 
37
38
  Exit codes: 0 content, 1 nothing derivable, 2 broken invocation or install.
38
39
 
40
+ ## After you produce a document
41
+ A deck, report, spreadsheet or PDF made for someone is not finished until you have checked it and looked at it.
42
+ 1. `fileq check <file>` (docx, pptx, xlsx, pdf) lists what a reader would meet, each with where it is:
43
+ `slide 3 · "Title 1"`, `'Q3 plan'!C4`, `page 7`, `paragraph 12 · "…"`. Exit 1 means an error (a missing
44
+ image, a #REF!, a broken link, leftover "Click to add title"): fix every one and check again. Warnings are
45
+ judgement calls (a TODO, a hidden slide) or estimates (text overflowing its box): settle those by looking.
46
+ 2. `fileq render <file> [--pages 1-3]` draws the pages or slides as PNGs (the first 20 unless you say) and
47
+ prints one path per line; Read them. An unchanged file answers from its last render. Office formats are laid
48
+ out by LibreOffice, so a font the machine lacks is substituted: judge overflow and spacing, not the typeface.
49
+ It needs LibreOffice (`soffice`) for office formats and `pdftoppm` (poppler-utils) or `mutool` for
50
+ every format. If it exits 2 naming one, install it or tell the user the document was checked but not seen.
51
+ Fix what you find in whatever generated the file, regenerate, and check again; after two rounds, stop and tell
52
+ the user what is left rather than looping.
53
+
54
+ ## Making a document someone will open
55
+ Rules that decide whether a generated file looks right (adapted from SurfSense's document skills, Apache-2.0):
56
+ - **Decks**: one purpose per slide, at most about six short bullets; titles 32–40 pt, body at least 18 pt;
57
+ 0.5 in outer margins, and every shape on the slide (no parking shapes off-canvas, no hidden spare slides).
58
+ Fill every placeholder you keep or delete it; no prompt text, TODOs or design notes on a slide. Size each
59
+ box to its text instead of relying on autofit, which PowerPoint and LibreOffice resolve differently: shorten
60
+ or split the slide. Keep an image's proportions: set one side and derive the other, crop rather than stretch.
61
+ - **Word documents**: built-in heading styles, real list numbering (never a typed "•"), a page break as its
62
+ own paragraph, margins of at least 18 mm, one page size and orientation. A table of contents only when asked,
63
+ and say its page numbers fill in when Word updates fields. No image wider than the text column.
64
+ - **Spreadsheets**: save every formula with its computed value (XlsxWriter's `write_formula(cell, formula,
65
+ format, value)`; openpyxl saves none, so recalculate its output with LibreOffice). Leave no error value
66
+ (#REF!, #DIV/0!, #N/A) in a cell. Name sheets for the reader, set column widths, freeze header rows.
67
+ - **PDFs**: embed the fonts (register a TTF in ReportLab; WeasyPrint embeds on its own); A4 or US Letter by
68
+ locale, margins of at least 18 mm. To turn an office file into a PDF:
69
+ `soffice --headless -env:UserInstallation=file:///tmp/lo-$$ --convert-to pdf --outdir <dir> <file>`
70
+ (its own profile per run; the output is named after the source).
71
+ - Fonts: prefer Arial, Times New Roman or Courier New where the layout is tight: LibreOffice substitutes their
72
+ metric-compatible Liberation fonts, so lines break the same. Any other font gets about 10% spare room.
73
+
39
74
  ## Text-shaped files that are too big to cat
40
75
  The commonest way to lose a context window is `cat` on a file you have not sized. Stat first, then read
41
76
  the shape, then only what the question needs: