@letsrebase/verify 0.1.0 → 0.1.1

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
@@ -93,7 +93,7 @@ Seven lenses, all built from your logs.
93
93
 
94
94
  Plus a trajectory block (how your behavior shifted across the observed window), three to five representative projects (adaptive: flagships by significance, extra slots only for type diversity or comparable significance), each carrying per-product orchestration counts: sessions per agent CLI (with overlapping vs disjoint activity periods), sub-agent delegations, and headless agent-dispatch commands (to the same tool or another; all lower bounds), and a groundedness check (the prose has to track back to the data; below 60%, submission is blocked).
95
95
 
96
- At submit time everything is re-checked, not trusted: groundedness is recomputed on the file as it is now, the structured numbers are re-derived from your logs (the profile can't claim more sessions or commits than the logs contain), and the intake recomputes groundedness and the structural invariants server-side on what it receives. An incoherent hand-edit of `candidate.json` doesn't survive the trip; the log-level re-derivation runs only on your machine, since your logs never leave it.
96
+ At submit time everything is re-checked, not trusted: groundedness is recomputed on the file as it is now, the structured numbers are re-derived from your logs (the profile can't claim more sessions, commits or code practice counts than the logs contain), and the intake recomputes groundedness and the structural invariants server-side on what it receives. An incoherent hand-edit of `candidate.json` doesn't survive the trip; the log-level re-derivation runs only on your machine, since your logs never leave it.
97
97
 
98
98
  The profile also discloses its own coverage: a `sources` block records which log sources were read, at what capture level (*full* = tamper-evident records the authenticity screen can verify; *structural* = well-formed data without a verification story), and how many sessions each contributed. The window and every count are **lower bounds** of your real activity, logs rotate and old sessions are pruned, so what the tool can still see is never more than what you did. Like the authenticity score, this is a screen, not proof.
99
99
 
@@ -147,6 +147,7 @@ How it is read:
147
147
  - **Failures.** `failure_reproduced_before_fix` only counts failed checks. A failed command that contains a check counts as a failed check, and in a chain such as `npm test && git push` the exit status cannot say which part failed, so the chain counts as its first check. Two runs are the same check when their command words match (the words before the first flag or path, wrappers dropped), so a narrower rerun of the same check (`pytest tests/a.py` after `pytest`) is the same command. Pi, oh-my-pi and Cursor sessions are left out of this practice, because their logs cannot show a failure reliably. A session whose adapter cannot give a field for a practice is left out of that practice rather than counted as not seen.
148
148
  - **Sessions with no time.** A session with no timestamped message cannot be placed in a month, so it is left out of every practice's counts. A practice no session could show (M is 0) is left out of the profile.
149
149
  - **Counts only.** Only the counts leave your machine, never a command, a path or a file name.
150
+ - **At submit.** The seven code practices are counted again from your logs, in the timezone the profile recorded, and a profile that claims more than that count is blocked, like the other numbers. The four model practices cannot be counted again, so only their shape is checked.
150
151
 
151
152
  The full rules are in `share/practices.json`, generated from `src/practices-rules.mjs`: every command pattern, the path patterns, the source extensions, the commit and pull request patterns, and the tool names read as a planning step or an edit.
152
153
 
@@ -60,7 +60,7 @@ import { computeAgenticLiteracy } from "../src/agentic-literacy.mjs";
60
60
  import { computeIntensity } from "../src/intensity.mjs";
61
61
  import { computeDistribution } from "../src/distribution.mjs";
62
62
  import { computeTechUsage, recordedTechUsageTz } from "../src/tech-usage.mjs";
63
- import { computeCodePractices, mergeModelPractices, practicesBlock } from "../src/practices.mjs";
63
+ import { computeCodePractices, mergeModelPractices, practicesBlock, recordedPracticesTz } from "../src/practices.mjs";
64
64
  import { DEFAULT_TZ } from "../src/days.mjs";
65
65
 
66
66
  // Friendly Node floor (package.json `engines` is advisory only when invoked
@@ -545,7 +545,8 @@ async function cmdSubmit({ yes = false } = {}) {
545
545
  const digest = buildDigest(parsed, { tz: techTz });
546
546
  const intensity = computeIntensity(parsed, { tz: profile.intensity?.timezone || DEFAULT_TZ });
547
547
  const techUsage = computeTechUsage(digest.projects, { tz: techTz });
548
- const logs = assessAgainstLogs(profile, digest.projects, { intensity, techUsage });
548
+ const practices = computeCodePractices(parsed, { tz: recordedPracticesTz(profile) });
549
+ const logs = assessAgainstLogs(profile, digest.projects, { intensity, techUsage, practices });
549
550
  issues.push(...logs.issues);
550
551
  excessClaims = logs.excessClaims || 0;
551
552
  for (const w of logs.warnings) console.log(` ~ ${w}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letsrebase/verify",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Work profile: build a tamper-evident, PII-redacted work profile from your coding-agent logs and send it to rebase for review.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -31,7 +31,7 @@
31
31
  "homepage": "https://github.com/letsrebase/verify",
32
32
  "repository": {
33
33
  "type": "git",
34
- "url": "https://github.com/letsrebase/verify.git"
34
+ "url": "git+https://github.com/letsrebase/verify.git"
35
35
  },
36
36
  "dependencies": {
37
37
  "@agentclientprotocol/sdk": "2.8.0",
@@ -23,7 +23,7 @@
23
23
  import { bandFor, monthSpan } from "./tech-usage.mjs";
24
24
  import { labelVocabulary } from "./digest.mjs";
25
25
  import { isValidTimezone } from "./days.mjs";
26
- import { RUBRIC, practicesArtifact } from "./practices-rules.mjs";
26
+ import { CODE_PRACTICES, RUBRIC, practicesArtifact } from "./practices-rules.mjs";
27
27
 
28
28
  // { agent, model } as the hub reads it: an agent id of 1-40 [a-z0-9-], a model
29
29
  // name of 1-120 printable, non-blank characters, or null.
@@ -232,6 +232,10 @@ export function submitBlockers({ issues = [], groundedness = null, force = false
232
232
  // .timezone })) — never the machine zone, or a candidate who generated with
233
233
  // --tz Europe/Rome and submits from a CI box would be flagged for the bucketing
234
234
  // difference, not for any real excess.
235
+ //
236
+ // opts.practices: the code practices recounted from the same logs in the zone the
237
+ // practices block RECORDED (computeCodePractices(parsed, { tz })), null when no
238
+ // session could show any of them. Left undefined, the recount is skipped.
235
239
  export function assessAgainstLogs(profile, digestProjects, opts = {}) {
236
240
  const issues = [];
237
241
  const warnings = [];
@@ -353,5 +357,26 @@ export function assessAgainstLogs(profile, digestProjects, opts = {}) {
353
357
  }
354
358
  }
355
359
 
360
+ // Code practices, same one-directional gate: every count only grows with
361
+ // ongoing use, so a claimed seen, of, products or months above the recount is
362
+ // pruning or a hand edit. Like dispatch detection, the counting rules are
363
+ // matcher-derived, so a tool update that narrows them shrinks the recount on
364
+ // unchanged logs; the remedy is the same: regenerate. The model practices are
365
+ // the person's model reading a sample, which no recount can repeat: they stay
366
+ // under the structure check alone. The rubric decides which ids are code, not
367
+ // the item's own method, which a hand edit could change.
368
+ const codeIds = new Set(CODE_PRACTICES.map((p) => p.id));
369
+ if (Array.isArray(profile?.practices?.items) && opts.practices !== undefined) {
370
+ const recounted = new Map((opts.practices?.items ?? []).map((x) => [x.id, x]));
371
+ for (const c of profile.practices.items) {
372
+ if (!codeIds.has(c?.id)) continue;
373
+ const d = recounted.get(c.id);
374
+ for (const k of ["seen", "of", "products", "months"]) {
375
+ const got = d?.[k] ?? 0;
376
+ if ((Number(c[k]) || 0) > got) excess(`practices.${c.id}: claims ${k} ${c[k]}, the logs recount ${got} (the counting rules may also have changed in an update: regenerate)`);
377
+ }
378
+ }
379
+ }
380
+
356
381
  return { issues, warnings, excessClaims };
357
382
  }
package/src/practices.mjs CHANGED
@@ -4,7 +4,7 @@
4
4
  // been": a session whose log lacks a field a practice needs (see `needs` in
5
5
  // practices-rules.mjs), or whose adapter cannot show it (ADAPTERS_WITHOUT), is
6
6
  // left out of that denominator, never counted as "not seen".
7
- import { DEFAULT_TZ, monthKeyFor } from "./days.mjs";
7
+ import { DEFAULT_TZ, isValidTimezone, monthKeyFor } from "./days.mjs";
8
8
  import { isEphemeral, repoKey, splitTopLevel, stripHeredocs } from "./digest.mjs";
9
9
  import {
10
10
  ADAPTERS_WITHOUT, CODE_PRACTICES, EDIT_TOOLS as EDIT_TOOL_NAMES, PLAN_TOOLS as PLAN_TOOL_NAMES, RUBRIC,
@@ -208,6 +208,13 @@ export function computeCodePractices(parsed, { tz = DEFAULT_TZ } = {}) {
208
208
  return items.length ? { items } : null;
209
209
  }
210
210
 
211
+ // The zone a submit recounts the code practices in: the one the block recorded,
212
+ // never the machine's, so the recount measures the data and not the bucketing.
213
+ export function recordedPracticesTz(profile) {
214
+ const tz = profile?.practices?.timezone;
215
+ return isValidTimezone(tz) ? tz : DEFAULT_TZ;
216
+ }
217
+
211
218
  // The block as the profile carries it: the rubric id and the zone the months
212
219
  // were bucketed in travel with the counts. No items, no block. `classifiedBy`
213
220
  // ({ agent, model }) names who read the sessions for the model items.