Skip to content

Commit c645e3e

Browse files
committed
Merge branch 'codex/audit-remediation'
2 parents 57cfd6e + e95a82b commit c645e3e

45 files changed

Lines changed: 4971 additions & 1986 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
branches: ["main"]
66
pull_request:
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
verify:
1013
runs-on: ubuntu-latest
@@ -27,14 +30,8 @@ jobs:
2730
- name: Install dependencies
2831
run: pnpm install --frozen-lockfile
2932

30-
- name: Typecheck
31-
run: pnpm typecheck
32-
33-
- name: Build
34-
run: pnpm build
35-
36-
- name: Test
37-
run: pnpm test
33+
- name: Verify
34+
run: pnpm verify
3835

3936
- name: Pack dry run
40-
run: npm pack --dry-run
37+
run: pnpm pack:check
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Dependency Review
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
dependency-review:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Check out repository
15+
uses: actions/checkout@v4
16+
17+
- name: Review dependency changes
18+
uses: actions/dependency-review-action@v4
19+
with:
20+
fail-on-severity: high

CONTRIBUTING.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Contributing
2+
3+
Thanks for helping with `paperclip-aperture`.
4+
5+
## Development Setup
6+
7+
```bash
8+
pnpm install
9+
pnpm verify
10+
```
11+
12+
`pnpm verify` is the main local gate. It runs:
13+
14+
- `pnpm typecheck`
15+
- `pnpm test`
16+
- `pnpm eval:issue-intelligence`
17+
- `pnpm build`
18+
- `pnpm check:bundle-size`
19+
20+
Use `pnpm release:check` before publish to run the full verification flow plus `npm pack --dry-run`.
21+
22+
If you want to clear local artifacts first:
23+
24+
```bash
25+
pnpm clean
26+
```
27+
28+
## Live Paperclip Smoke Test
29+
30+
Build the plugin:
31+
32+
```bash
33+
pnpm build
34+
```
35+
36+
Run Paperclip in one terminal:
37+
38+
```bash
39+
npx paperclipai run -i default
40+
```
41+
42+
Install the local plugin in another:
43+
44+
```bash
45+
npx paperclipai context set --api-base http://localhost:3100
46+
npx paperclipai plugin uninstall tomismeta.paperclip-aperture --force
47+
npx paperclipai plugin install --local .
48+
```
49+
50+
Then open `http://127.0.0.1:3100/APE/aperture`.
51+
52+
## Architecture Boundaries
53+
54+
Please keep the boundary honest:
55+
56+
- Aperture Core owns continuity, replay, engagement, and attention mechanics.
57+
- The plugin worker owns Paperclip-specific host adaptation, reconciliation, approval overlays, and persisted review state.
58+
- The UI owns presentation and operator interaction wiring.
59+
60+
This plugin is not meant to become a second independent attention engine. If a change starts inventing new generic ranking policy inside the plugin, pause and ask whether it belongs in Aperture Core instead.
61+
62+
## Change Expectations
63+
64+
- Prefer extending the worker-side adapters and typed contracts over ad hoc UI logic.
65+
- Keep task and interaction identity flowing through the shared task-ref helpers instead of hand-parsing ids.
66+
- Preserve bounded exports and bundle budgets unless you deliberately revisit those limits.
67+
- Add or update tests whenever behavior, persistence, or reconciliation logic changes.

README.md

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Paperclip Aperture
44

5-
**The live attention layer for Paperclip, powered by Aperture's deterministic attention engine.**
5+
**The live attention layer for Paperclip, combining Aperture Core continuity with Paperclip-native operator policy.**
66

77
[![paperclip-aperture npm](https://img.shields.io/npm/v/%40tomismeta%2Fpaperclip-aperture?label=paperclip-aperture&color=2563eb)](https://www.npmjs.com/package/@tomismeta/paperclip-aperture)
88
[![aperture github](https://img.shields.io/badge/aperture-tomismeta%2Faperture-18181b)](https://github.com/tomismeta/aperture)
@@ -13,7 +13,7 @@
1313
<p></p>
1414
</div>
1515

16-
Paperclip Aperture adds a Focus surface to Paperclip that deterministically ranks approvals, issue activity, and other human-facing events into `now`, `next`, and `ambient`.
16+
Paperclip Aperture adds a Focus surface to Paperclip that turns approvals, issue activity, and other human-facing signals into `now`, `next`, and `ambient`.
1717

1818
It is designed as a live attention layer, not an inbox clone:
1919

@@ -66,16 +66,27 @@ and agents attention now? actually sees to th
6666
- a Focus surface inside Paperclip
6767
- ranked `now`, `next`, and `ambient` attention lanes
6868
- embedded explainability in the Focus UI, including `Why now`, `Why next`, confidence, signals, thread context, and related activity
69+
- bounded focus hold while the operator is actively working the current `now` item, so `Show context` and inline commenting do not immediately lose the thread beneath them
6970
- approval handling, including budget-specific approval semantics
7071
- issue-aware operator language such as `review required`, `blocked`, and targeted recommended moves
7172
- agent-aware routing that distinguishes known company agents from human/operator roles when issue text references them
72-
- a plugin-local deterministic semantic mapping layer that interprets Paperclip issue, approval, and agent signals before publishing them into Aperture Core
73+
- a plugin-local semantic mapping and policy layer that interprets Paperclip issue, approval, and agent signals before composing the final Focus view
7374
- richer semantic continuity hints on mapped issue events, including `supersedes` and `resolves` relationships where Paperclip-specific intent is clear
7475
- document-aware review interpretation for memo/spec-backed issues so Focus can tell the difference between `review is blocked on the artifact` and `the artifact is attached, monitor instead`
7576
- dynamic re-stacking so items can move between `now`, `next`, and `ambient` as new evidence arrives
7677
- inline issue commenting from the Focus surface when a Paperclip issue supports written response
7778
- durable acknowledge/suppression behavior backed by plugin state and ledger replay
79+
- worker-owned display composition that merges live Paperclip approvals into the final Focus snapshot before the UI sees it
80+
- bounded Core trace export and sparse Focus action telemetry/activity writes for replay and debugging
81+
- live Core diagnostics export, including signal summaries, memory profile snapshots, and current-session attention state for offline analysis
82+
- worker-bridged operator signals for Focus page presence, active-item viewing, and context expansion so Aperture Core sees real interaction evidence instead of the plugin faking a second attention model
83+
- overlay diagnostics export that compares `core -> reconciled -> display` so the plugin's host-policy contribution is inspectable without confusing it for Core judgment
7884
- a sidebar entry, page, and dashboard widget
85+
- worker-side host read caching for issue/comment/document/agent reconciliation, with fresh summary/export reads when you need the latest host truth
86+
- bounded per-company Core sessions with health reporting so the worker does not grow without limit during normal multi-company use
87+
- a corpus-backed `issue-intelligence` regression check in CI so heuristic edits stay inspectable
88+
- rollback-safe local mutations that restore the last durable attention state if persistence fails
89+
- versioned persisted attention envelopes with an explicit migration path for older schemas
7990

8091
## Explainability
8192

@@ -99,33 +110,39 @@ The intent is not to expose every internal scoring detail. It is to help an oper
99110

100111
This plugin treats Paperclip as the host runtime and UI shell, while embedding [Aperture Core](https://github.com/tomismeta/aperture/tree/main/packages/core) through the npm package [`@tomismeta/aperture-core`](https://www.npmjs.com/package/@tomismeta/aperture-core).
101112

102-
It is a pure SDK integration: Aperture Core is used as-is inside a self-contained Paperclip plugin, with no changes to Aperture Core or Paperclip core.
113+
It is an SDK-first integration with explicit plugin-side host policy. Aperture Core handles continuity, replay, and global attention mechanics; the plugin adds Paperclip-specific candidate generation, approval overlays, and operator language where the host can know more than Core alone.
103114

104-
For `0.3.x`, the boundary works like this:
115+
For `0.4.x`, the boundary works like this:
105116

106-
- the plugin worker owns Aperture ingestion, replay, review state, and display composition
117+
- the plugin worker owns Aperture ingestion, replay, review state, display composition, reconciliation caching, and Paperclip-native policy overlays
118+
- the final Focus view is therefore Core-backed but not Core-only today: the plugin still owns some Paperclip-specific candidate and lane policy where the host has facts Core cannot infer by itself
107119
- Paperclip remains the system of record for issue and approval writes
108-
- approval transport still goes through same-origin Paperclip HTTP APIs from the plugin UI because the current plugin SDK does not expose approval read/write clients
120+
- approval transport now goes through a worker-side Paperclip adapter using the plugin SDK HTTP client, so the browser UI no longer talks to host approval APIs directly
109121
- the plugin intentionally publishes `ApertureEvent`s today, using a Paperclip-specific semantic mapping layer and ontology, rather than switching fully to `SourceEvent`
110-
- that semantic layer includes reusable intent detectors, actor resolution against real company agents, downstream blocker extraction, and shared operator-language generation inside the plugin
122+
- that semantic layer includes reusable intent detectors, actor resolution against real company agents, downstream blocker extraction, explicit rule ids for matched issue heuristics, and shared operator-language generation inside the plugin
123+
- `activity.logged` document events invalidate stale reconciled state so document-backed review blockers refresh promptly without a full browser-side merge layer
124+
- Focus exports the live Core snapshot, the reconciled/plugin-composed display snapshot, and bounded Core traces so replay/debug flows can inspect both the engine substrate and the final operator view
111125

112-
The plugin has been validated against [`@tomismeta/aperture-core@0.4.0`](https://www.npmjs.com/package/@tomismeta/aperture-core).
126+
The plugin has been validated against [`@tomismeta/aperture-core@0.6.0`](https://www.npmjs.com/package/@tomismeta/aperture-core) and [`@paperclipai/plugin-sdk@2026.403.0`](https://www.npmjs.com/package/@paperclipai/plugin-sdk).
127+
128+
If your Paperclip host is not running at the default local address, set the plugin config field `paperclipApiBase` so the worker-side approval adapter can reach the correct host API.
113129

114130
## Development
115131

116132
```bash
117133
pnpm install
118-
pnpm typecheck
119-
pnpm test
120-
pnpm build
134+
pnpm verify
121135
```
122136

123137
Before releasing, run:
124138

125139
```bash
140+
pnpm clean
126141
pnpm release:check
127142
```
128143

144+
`pnpm verify` runs typecheck, tests, the issue-intelligence eval corpus, a production build, and bundle-size checks.
145+
129146
For a live local Paperclip smoke test, start Paperclip first:
130147

131148
```bash
@@ -156,6 +173,8 @@ Then open `http://127.0.0.1:3100/APE/aperture` and verify:
156173

157174
- Plugin on npm: [`@tomismeta/paperclip-aperture`](https://www.npmjs.com/package/@tomismeta/paperclip-aperture)
158175
- Roadmap and releasing: [docs/ROADMAP.md](./docs/ROADMAP.md)
176+
- Architecture remediation note: [docs/AUDIT-REMEDIATION-2026-04.md](./docs/AUDIT-REMEDIATION-2026-04.md)
177+
- Contribution guide: [CONTRIBUTING.md](./CONTRIBUTING.md)
159178
- Aperture GitHub repo: [tomismeta/aperture](https://github.com/tomismeta/aperture)
160179
- Aperture Core on npm: [`@tomismeta/aperture-core`](https://www.npmjs.com/package/@tomismeta/aperture-core)
161180
- Paperclip GitHub repo: [paperclipai/paperclip](https://github.com/paperclipai/paperclip)

0 commit comments

Comments
 (0)