@kujolang/paperclip 0.1.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 (49) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/LICENSE +21 -0
  3. package/README.md +116 -0
  4. package/SECURITY.md +35 -0
  5. package/VERSION +1 -0
  6. package/bundled/components/changebucket/LICENSE +9 -0
  7. package/bundled/components/changebucket/changebucket.kujo +12 -0
  8. package/bundled/components/changebucket/src/analyze.kujo +240 -0
  9. package/bundled/components/changebucket/src/budget.kujo +92 -0
  10. package/bundled/components/changebucket/src/classify.kujo +221 -0
  11. package/bundled/components/changebucket/src/cli.kujo +324 -0
  12. package/bundled/components/changebucket/src/diffsrc.kujo +252 -0
  13. package/bundled/components/changebucket/src/render.kujo +346 -0
  14. package/bundled/components/changebucket/src/util.kujo +62 -0
  15. package/bundled/components/context/LICENSE +9 -0
  16. package/bundled/components/context/scent.kujo +3250 -0
  17. package/bundled/components/failure-evidence/LICENSE +9 -0
  18. package/bundled/components/failure-evidence/casefile.kujo +2061 -0
  19. package/bundled/components/patchbrief/LICENSE +9 -0
  20. package/bundled/components/patchbrief/patchbrief.kujo +153 -0
  21. package/bundled/components/patchbrief/schemas/patchbrief-handoff.schema.json +38 -0
  22. package/bundled/components/patchbrief/schemas/patchbrief-summary.schema.json +46 -0
  23. package/bundled/components/patchbrief/src/common.kujo +212 -0
  24. package/bundled/components/patchbrief/src/git.kujo +250 -0
  25. package/bundled/components/patchbrief/src/handoff.kujo +145 -0
  26. package/bundled/components/patchbrief/src/suggest_tests.kujo +137 -0
  27. package/bundled/components/patchbrief/src/summarize.kujo +309 -0
  28. package/bundled/kujo-components.lock.json +134 -0
  29. package/dist/manifest.js +14696 -0
  30. package/dist/ui/index.js +179 -0
  31. package/dist/worker.js +30536 -0
  32. package/docs/ARCHITECTURE.md +28 -0
  33. package/docs/CATALOG_SUBMISSION.md +25 -0
  34. package/docs/COMPATIBILITY.md +21 -0
  35. package/docs/CONFIGURATION.md +33 -0
  36. package/docs/INSTALLATION.md +53 -0
  37. package/docs/OPERATIONS.md +60 -0
  38. package/docs/README.md +18 -0
  39. package/docs/RELEASE_READINESS.md +46 -0
  40. package/docs/THREAT_MODEL.md +26 -0
  41. package/docs/TROUBLESHOOTING.md +12 -0
  42. package/docs/USAGE.md +95 -0
  43. package/examples/agent-workflow.md +20 -0
  44. package/package.json +71 -0
  45. package/schemas/changebucket-analysis.schema.json +25 -0
  46. package/schemas/context-pack.schema.json +23 -0
  47. package/schemas/failure-evidence.schema.json +18 -0
  48. package/schemas/review-pack.schema.json +19 -0
  49. package/skills/scoped-repository-context/SKILL.md +9 -0
@@ -0,0 +1,28 @@
1
+ # Architecture
2
+
3
+ ```text
4
+ Paperclip issue/project/run context
5
+ -> @kujolang/paperclip worker (typed validation and workspace resolution)
6
+ -> @kujolang/kujo-runtime (configured, bundled, then optional PATH fallback)
7
+ -> allowlisted pinned component (ChangeBucket, PatchBrief, CaseFile, Scent)
8
+ -> bounded machine output
9
+ -> normalized schema v1
10
+ -> Paperclip plugin state and native detail tab
11
+ ```
12
+
13
+ Paperclip remains the system of record for companies, projects, workspaces, issues, runs, approvals, budgets, and authentication. The plugin requests only project/workspace reads, agent-tool registration, plugin state, its detail tab, and its managed guidance skill.
14
+
15
+ All execution enters through `executeKujo()`. It uses `spawn`, never a shell, validates a real absolute working directory, passes a minimal allowlisted environment, caps stdout/stderr, and applies a timeout. Feature code can call only IDs in the compiled component registry. Registry resolution validates the complete bundle against the lock before returning an entrypoint. Context selection runs against a task-ranked temporary mirror of at most four Git-visible regular files, so ignored dependency trees and other ambient files never enter Scent's walk.
16
+
17
+ Artifacts use Paperclip state scopes: Review and Context Packs are stored against their project or issue; Failure Evidence is stored against its run. Generated CaseFile/Scent scratch output is created in a private temporary directory and removed after normalization. Project repositories remain read-only.
18
+
19
+ ## Public contracts
20
+
21
+ - npm packages and runtime resolver API documented in the Kujo runtime repository
22
+ - Paperclip manifest API version 1 and minimum host version `2026.824.1`
23
+ - four namespaced agent tools declared in the manifest and worker
24
+ - component lock schema version 1
25
+ - Review Pack, Failure Evidence, and Context Pack schema version 1
26
+ - additive JSON compatibility within a plugin major version
27
+
28
+ Review generation captures a git snapshot before parallel read-only ChangeBucket/PatchBrief calls and checks it afterward. Partial PatchBrief failure preserves an accurate ChangeBucket footprint and records component status. Context cache identity combines workspace, HEAD/dirty fingerprint, normalized task, depth, and component version. The v0.1 worker records the key but intentionally regenerates instead of adding a second cache index.
@@ -0,0 +1,25 @@
1
+ # Paperclip catalog submission
2
+
3
+ **Name:** Kujo — Reviewable Agent Work
4
+ **Package:** `@kujolang/paperclip`
5
+ **Repository/support:** `https://github.com/kujolang/paperclip`
6
+ **License:** MIT
7
+ **Minimum host:** Paperclip `2026.824.1`
8
+
9
+ **Description:** Add scoped context, change review, and reproducible evidence to Paperclip agent workflows.
10
+
11
+ ## Requested capabilities
12
+
13
+ - `agent.tools.register`: four explicitly declared bounded tools
14
+ - `projects.read`, `project.workspaces.read`: canonical workspace resolution only
15
+ - `plugin.state.read`, `plugin.state.write`: normalized artifact persistence
16
+ - `ui.detailTab.register`: one shared Kujo tab on project/issue/run details
17
+ - `skills.managed`: optional Scoped Repository Context guidance
18
+
19
+ The plugin requests no HTTP, secret, issue-write, approval, budget, database, job, webhook, or arbitrary local-folder capability.
20
+
21
+ ## UI walkthrough
22
+
23
+ The shared Kujo tab starts with runtime/artifact status. Issue/project views provide **Generate Review Pack**, **Generate Context Pack**, and **Capture Failure Evidence** actions. Review shows blast radius, explainable signals, and clearly labeled suggested verification. Failure Evidence shows bounded excerpts and redaction counts. Context shows selected paths, reasons, estimated tokens, depth, and stale/budget status. Run views show associated persisted evidence without exposing a terminal.
24
+
25
+ Catalog review should require the tagged cross-platform workflow, npm provenance for all six runtime packages and this plugin, install/upgrade/uninstall evidence on the declared minimum host, and the security assertions in `THREAT_MODEL.md`.
@@ -0,0 +1,21 @@
1
+ # Compatibility policy
2
+
3
+ ## Supported versions
4
+
5
+ | Dependency | Supported range | CI coverage |
6
+ | --- | --- | --- |
7
+ | Paperclip | `2026.824.1` and later in the current compatibility train | SDK minimum and latest |
8
+ | Node.js | `24.11.0` through the latest Node 24 release | minimum and latest Node 24 |
9
+ | Kujo runtime | bundled `1.2.2` | five native targets |
10
+
11
+ The plugin supports macOS arm64/x64, Linux arm64/x64, and Windows x64. CI runs the full plugin suite on each target at the minimum Node version. A separate compatibility job tests the minimum and latest Paperclip SDK against the minimum and latest Node 24 release.
12
+
13
+ ## Change rules
14
+
15
+ - Patch releases keep the same artifact schemas and minimum host train.
16
+ - Before 1.0, a minor release may add fields or raise a minimum version. The changelog must call out either change.
17
+ - Readers accept additive fields but reject unknown schema versions.
18
+ - Context content requires the same company, project, workspace, and Git snapshot that produced the pack.
19
+ - Component and runtime updates require the full native matrix and clean-install smoke test.
20
+
21
+ Paperclip releases outside the tested train are not supported until the scheduled compatibility job passes and the table is updated.
@@ -0,0 +1,33 @@
1
+ # Configuration
2
+
3
+ Paperclip renders these settings from the plugin manifest.
4
+
5
+ ## Runtime
6
+
7
+ | Setting | Default | Meaning |
8
+ | --- | --- | --- |
9
+ | `runtime.binary` | `null` | Absolute Kujo binary override. Relative paths are rejected. |
10
+ | `runtime.allowSystemPathFallback` | `true` | Allow a compatible absolute `kujo` found on `PATH` after bundled resolution fails. |
11
+
12
+ Bundled runtime resolution is the normal choice. Use an override only for controlled development or recovery.
13
+
14
+ ## Features
15
+
16
+ | Setting | Default | Meaning |
17
+ | --- | --- | --- |
18
+ | `features.review` | `true` | Enable Review Pack tools and actions. |
19
+ | `features.failureEvidence` | `true` | Enable Failure Evidence tools and actions. |
20
+ | `features.context` | `true` | Enable Context Pack tools and actions. |
21
+ | `features.verification` | `false` | Reserve the experimental verification surface. Enabling it produces a warning in `0.1.x`. |
22
+
23
+ ## Process limits
24
+
25
+ | Setting | Default | Allowed range |
26
+ | --- | ---: | ---: |
27
+ | `limits.timeoutMs` | 27,000 | 1,000–27,000 |
28
+ | `limits.maxStdoutBytes` | 2,000,000 | 1,024–10,000,000 |
29
+ | `limits.maxStderrBytes` | 256,000 | 1,024–2,000,000 |
30
+
31
+ Raising a limit increases the resources available to a local component and the amount of data the host may retain. Change limits only for a known repository need.
32
+
33
+ Other fixed bounds include a 200 KB Failure Evidence log input, 100 KB Context Pack selection limit per file, and 1 MB hard refusal for content reads.
@@ -0,0 +1,53 @@
1
+ # Installation
2
+
3
+ ## Requirements
4
+
5
+ - Paperclip `2026.824.1` or later
6
+ - Node.js `24.11.0` or later
7
+ - a Paperclip project with a local Git workspace for Review and Context Packs
8
+
9
+ ## Install from npm
10
+
11
+ ```bash
12
+ npx paperclipai plugin install @kujolang/paperclip
13
+ ```
14
+
15
+ Restart Paperclip if it is running. Open a project, issue, or run, select the **Kujo** tab, and check the status panel.
16
+
17
+ The package installs `@kujolang/kujo-runtime` and one matching optional native package. Supported targets are macOS arm64/x64, Linux arm64/x64, and Windows x64. No Kujo package uses `preinstall`, `install`, or `postinstall`.
18
+
19
+ ## Upgrade
20
+
21
+ Use Paperclip's plugin upgrade command for `@kujolang/paperclip`, then restart the host. Keep the plugin, Paperclip host, and Kujo runtime within the versions listed in the main README.
22
+
23
+ Artifact schema version 1 stays readable across compatible `0.1.x` releases.
24
+
25
+ ## Uninstall
26
+
27
+ Use Paperclip's normal plugin uninstall flow. A standard uninstall follows the host's retention policy for plugin state. An explicit purge removes plugin state. Neither operation changes project source.
28
+
29
+ ## Develop from source
30
+
31
+ Clone `kujolang/kujo` and `kujolang/paperclip` as siblings. Build Kujo, then install and verify the plugin:
32
+
33
+ ```bash
34
+ cd kujo
35
+ cargo build --release --bin kujo
36
+
37
+ cd ../paperclip
38
+ npm ci --ignore-scripts
39
+ npm run verify
40
+ ```
41
+
42
+ Set `KUJO_INTEGRATION_BINARY` if the Kujo binary is not at `../kujo/target/release/kujo`.
43
+
44
+ ## Verify a release
45
+
46
+ After publication:
47
+
48
+ ```bash
49
+ npm view @kujolang/paperclip version dist.integrity dist.attestations
50
+ npm pack @kujolang/paperclip --dry-run
51
+ ```
52
+
53
+ Install it in a clean Paperclip host, confirm the Kujo status panel, and exercise one Review, Failure Evidence, and Context Pack before promoting the release.
@@ -0,0 +1,60 @@
1
+ # Operations
2
+
3
+ ## Health and audit trail
4
+
5
+ Paperclip reports worker health and component integrity in the plugin status view. A healthy worker has four verified components. Runtime compatibility is checked when a feature first runs.
6
+
7
+ Successful generation, Context content reads, and data clearing write company-scoped Paperclip activity events. Events contain the operation, entity, and artifact ID. They do not contain source, logs, commands, or file contents. Paperclip owns activity-log retention and export.
8
+
9
+ The plugin stores only the latest artifact of each type for an entity. State namespaces include the company ID. Use **Clear Kujo data** on a project or issue to remove its Review, Failure, and Context artifacts. Paperclip owns backup retention and deletion for run-scoped state.
10
+
11
+ ## Upgrade
12
+
13
+ 1. Read the changelog and compatibility table.
14
+ 2. Back up Paperclip by using the host's normal backup process.
15
+ 3. Install the exact target version: `npx paperclipai plugin install @kujolang/paperclip@<version>`.
16
+ 4. Restart the worker.
17
+ 5. Check plugin health, generate a Context Pack in a test project, and run a Review Pack against a small known change.
18
+
19
+ The reader validates stored artifact schemas. It ignores corrupt or unsupported artifacts instead of rendering them. Generate a new artifact after an upgrade if an older one no longer loads.
20
+
21
+ ## Rollback
22
+
23
+ Install the previous exact version and restart the worker. Do not reuse a Context Pack across a rollback unless its schema, workspace ID, and Git snapshot still match. Generate a new pack when in doubt.
24
+
25
+ If a bad release affected stored data, clear the entity's Kujo data before regenerating it. A rollback does not restore artifacts that a newer version replaced.
26
+
27
+ ## Rotate bundled components
28
+
29
+ Component updates must start from clean, reviewed source repositories at exact commits.
30
+
31
+ 1. Update `components.sources.json` with the source commit and version.
32
+ 2. Run `npm run components:sync`.
33
+ 3. Review the full component diff and generated lock file.
34
+ 4. Run `npm run verify` on every supported platform.
35
+ 5. Release the plugin only after the referenced Kujo runtime is available on npm.
36
+
37
+ Never hand-edit a bundled file without updating its canonical source. Runtime checks reject any file that differs from the component lock.
38
+
39
+ ## Recover from corrupt state
40
+
41
+ If a detail view shows no artifact after an upgrade, inspect worker logs for schema or state errors. Clear the entity's Kujo data, then regenerate the artifact. Do not edit Paperclip's plugin-state tables directly.
42
+
43
+ If component integrity fails, reinstall the exact npm package. If runtime resolution fails, remove an invalid binary override or reinstall optional dependencies. Keep system `PATH` fallback disabled on tightly controlled hosts.
44
+
45
+ ## Incident response
46
+
47
+ 1. Disable the affected feature in company settings. Server-side checks block its tools, actions, reads, and Context content access.
48
+ 2. Stop or restart the plugin worker. Shutdown cancels active Kujo process groups.
49
+ 3. Preserve Paperclip activity records, worker logs, package version, component lock, and npm integrity metadata.
50
+ 4. Clear affected artifacts if they may contain sensitive data.
51
+ 5. Rotate any credential found in supplied logs. Redaction is a safeguard, not proof that a log contains no secret.
52
+ 6. Report product vulnerabilities through the private channel in `SECURITY.md`.
53
+
54
+ Do not post private logs, workspace paths, or exploit details in public issues.
55
+
56
+ ## Service expectations
57
+
58
+ Kujo for Paperclip is a local plugin. Availability follows the Paperclip host and local Kujo process. The project does not promise a response-time or uptime SLA. GitHub issues are the public support channel for reproducible non-security defects. Security reports use GitHub Security Advisories.
59
+
60
+ Each operation has a hard time and output budget. Review and Context reject Git-visible files larger than 25 MB or workspaces with more than 100,000 Git-visible files before starting a bundled analyzer. Split or exclude oversized inputs instead of raising this guard.
package/docs/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # Documentation
2
+
3
+ Start with [Installation](INSTALLATION.md), then [Usage](USAGE.md).
4
+
5
+ | Document | Purpose |
6
+ | --- | --- |
7
+ | [Installation](INSTALLATION.md) | Requirements, install, upgrade, uninstall, and local development. |
8
+ | [Usage](USAGE.md) | UI actions, agent tools, inputs, outputs, and workflows. |
9
+ | [Configuration](CONFIGURATION.md) | Feature switches, runtime selection, and limits. |
10
+ | [Compatibility](COMPATIBILITY.md) | Supported host, SDK, Node, runtime, and schema rules. |
11
+ | [Architecture](ARCHITECTURE.md) | Host integration, components, state, and data flow. |
12
+ | [Threat model](THREAT_MODEL.md) | Assets, trust boundaries, abuse cases, and mitigations. |
13
+ | [Troubleshooting](TROUBLESHOOTING.md) | Runtime, component, workspace, and output errors. |
14
+ | [Release readiness](RELEASE_READINESS.md) | Release order, test matrix, and operator checks. |
15
+ | [Operations](OPERATIONS.md) | Health, audit, retention, upgrades, rollback, recovery, and incident response. |
16
+ | [Catalog submission](CATALOG_SUBMISSION.md) | Paperclip catalog metadata and review evidence. |
17
+
18
+ Repository policy lives in [SECURITY.md](../SECURITY.md), [CONTRIBUTING.md](../CONTRIBUTING.md), and [AGENTS.md](../AGENTS.md).
@@ -0,0 +1,46 @@
1
+ # v0.1 release readiness
2
+
3
+ ## Gates
4
+
5
+ | Gate | Local result |
6
+ | --- | --- |
7
+ | TypeScript strict typecheck | automated by `npm run verify` |
8
+ | Unit/contract tests | automated by Vitest |
9
+ | Official Paperclip SDK worker harness | automated by Vitest |
10
+ | Real ChangeBucket/PatchBrief fixture | automated by Vitest |
11
+ | Real CaseFile redaction fixture | automated by Vitest |
12
+ | Real Scent relevance/budget fixture | automated by Vitest |
13
+ | Component SHA-256/provenance | `components:verify` |
14
+ | Dependency audit, integrity, licenses, and SBOM | `supply-chain:verify` |
15
+ | Tenant isolation and stored-state validation | automated by Vitest |
16
+ | Feature-policy enforcement on tools and UI bridges | automated by Vitest |
17
+ | Hostile Git configuration suppression | automated by Vitest |
18
+ | Timeout, cancellation, and descendant-process cleanup | automated by Vitest |
19
+ | Oversized workspace rejection | automated by Vitest |
20
+ | Worker/manifest/UI bundles | esbuild with official SDK preset |
21
+ | npm tarball contents | `pack:verify` |
22
+ | Runtime resolver/package tests | owned by the Kujo runtime repository |
23
+
24
+ The release order is platform runtime packages, neutral `@kujolang/kujo-runtime`, component sync/verification, plugin tarball clean-install verification, then `@kujolang/paperclip`. Platform binaries and the resolver must use the same Kujo version. The resolver is published last among runtime packages so it never points to missing versions.
25
+
26
+ ## Matrix
27
+
28
+ The runtime release workflows build and smoke macOS arm64/x64, Linux arm64/x64, and Windows x64. Paperclip CI tests those five targets. A separate compatibility matrix tests Node.js 24.11 and current Node.js 24 against the minimum, locked, and latest compatible Paperclip SDK versions. Local plugin feature execution is verified on the developer host; every supported target is exercised during a tagged release.
29
+
30
+ The tag workflow accepts only an annotated PGP-signed tag whose name matches `package.json`. It verifies the repository, packs once, attests that tarball, publishes that exact file with npm provenance, and attaches its checksum, CycloneDX SBOM, component lock, and JSON schemas to the GitHub release.
31
+
32
+ ## Performance bounds
33
+
34
+ - component timeout: 27 seconds, below the Paperclip bridge deadline
35
+ - stdout: 2 MB; stderr: 256 KB
36
+ - Failure Evidence input: 200 KB with explicit middle truncation
37
+ - Git-visible workspace: 100,000 files and 25 MB per file before component execution
38
+ - Context presets: approximately 4K/16K/40K tokens and 2/3/4 files
39
+ - context file: 2 KB during selection and 1 MB hard read refusal
40
+ - Review file rows retained by canonical output; UI eagerly renders at most 20 context entries and 12 suggested tests
41
+
42
+ The v0.1 deterministic suite remains in Vitest because these contracts combine the Paperclip SDK harness, native-process bounds, filesystem escape checks, and JSON assertions directly. Kujo Spec/Eval would add a second runner without improving determinism for this release; the versioned schemas and fixture cases are ready to export into Eval when the plugin adds executable verification.
43
+
44
+ ## Release decision
45
+
46
+ SHIP only after the protected-branch checks pass, the compatibility workflow passes, the signed-tag workflow succeeds, the seven runtime/plugin npm names are available, a clean-room npm install passes, and a real Paperclip host loads the published package and exercises its tools.
@@ -0,0 +1,26 @@
1
+ # Threat model
2
+
3
+ ## Assets and trust boundaries
4
+
5
+ The protected assets are project source, credentials, Paperclip tenant identity, plugin state, and the integrity of generated evidence. Paperclip plugin code is trusted installed code; manifest capabilities gate worker host APIs but same-origin plugin UI is not an isolation boundary. Native runtime and bundled Kujo source are release inputs verified by package/component checksums.
6
+
7
+ ## Attack surfaces and controls
8
+
9
+ | Surface | Control |
10
+ | --- | --- |
11
+ | Malicious filenames, refs, or tool parameters | Zod validation, bounded lengths, strict git-ref grammar, no shell interpolation |
12
+ | Workspace traversal or symlink escape | Host workspace lookup, `realpath`, containment checks, selected-path allowlist |
13
+ | Arbitrary Kujo scripts | Compile-time component ID union and locked registry; no user path parameter |
14
+ | Huge files, diffs, logs, or process output | Component budgets, file/byte limits, stdout/stderr caps, timeouts, bounded UI rows |
15
+ | Secrets in logs/files | Safe environment allowlist, CaseFile/Scent redaction, second defensive redaction, sensitive-path denylist |
16
+ | Package/component substitution | exact dependency versions, platform package selection, lock commit/version/license/SHA-256, runtime integrity verification |
17
+ | Cross-company spoofing | action company scope comes from immutable host context; tool scope comes from `ToolRunContext` |
18
+ | Stale or corrupt artifacts | schema version, provenance, git snapshot fingerprint, stale marker, component integrity check |
19
+ | Worker failure | structured errors returned from tools; component nonzero exit does not crash the host |
20
+
21
+ The plugin does not execute suggested tests, rerun failures, expose terminal access, mutate `PATH`, inherit arbitrary environment values, download code at runtime, or write artifacts into project source by default.
22
+
23
+ ## Residual risks
24
+
25
+ Pattern redaction is defense in depth, not a mathematical guarantee. Operators should still review artifacts before external sharing. Paperclip UI code is trusted same-origin JavaScript in the current plugin architecture. Native package publication and cross-platform CI require supply-chain controls outside the running worker; release uses npm provenance and publishes the neutral resolver last.
26
+
@@ -0,0 +1,12 @@
1
+ # Troubleshooting
2
+
3
+ - `KUJO_RUNTIME_NOT_FOUND`: reinstall with optional dependencies enabled, confirm the target is supported, or configure an absolute Kujo 1.2+ binary.
4
+ - `KUJO_RUNTIME_INCOMPATIBLE`: upgrade the configured/PATH runtime to 1.2 or remove the override to use the bundled version.
5
+ - `KUJO_COMPONENT_INTEGRITY_FAILED`: reinstall the plugin from npm; do not edit installed bundle files.
6
+ - `KUJO_WORKSPACE_NOT_FOUND`: attach a primary local workspace to the Paperclip project.
7
+ - `KUJO_EXEC_TIMEOUT` or `KUJO_OUTPUT_LIMIT`: narrow the change/context or raise the administrator limit within the schema maximum.
8
+ - Not a git repository: Review Pack requires a git-backed workspace with a valid `HEAD`; Context and Failure Evidence remain independently usable.
9
+ - Stale Review/Context Pack: regenerate after HEAD or the dirty working tree changes.
10
+ - Unsupported target: v0.1 supports macOS arm64/x64, Linux arm64/x64, and Windows x64.
11
+ - Worker crash: open plugin health, verify the exact Paperclip compatibility train, then reinstall. Component failures should normally appear as structured feature errors rather than crash the worker.
12
+
package/docs/USAGE.md ADDED
@@ -0,0 +1,95 @@
1
+ # Usage
2
+
3
+ ## Paperclip UI
4
+
5
+ Open the **Kujo** detail tab on a project or issue.
6
+
7
+ - **Generate Review Pack** measures the current working tree and builds a handoff.
8
+ - **Generate Context Pack** selects files for a task at minimal, focused, or broad depth.
9
+ - **Capture Failure Evidence** stores supplied command details and logs after bounding and redaction.
10
+
11
+ Run views display saved evidence. They do not expose a terminal.
12
+
13
+ ## Agent tools
14
+
15
+ ### Review changes
16
+
17
+ ```json
18
+ {
19
+ "mode": "working_tree"
20
+ }
21
+ ```
22
+
23
+ Use range mode only with valid Git refs:
24
+
25
+ ```json
26
+ {
27
+ "mode": "range",
28
+ "base": "main",
29
+ "head": "HEAD"
30
+ }
31
+ ```
32
+
33
+ The result includes changed-file and churn counts, risk level, explainable signals, component status, stale state, and suggested tests. Suggested tests are not proof that a command ran.
34
+
35
+ ### Capture failure evidence
36
+
37
+ ```json
38
+ {
39
+ "title": "Unit test failed",
40
+ "command": "npm test",
41
+ "exitCode": 1,
42
+ "durationMs": 4200,
43
+ "log": "bounded test output",
44
+ "notes": "failure occurred after the parser change"
45
+ }
46
+ ```
47
+
48
+ The tool does not execute `command`. It stores bounded, redacted evidence from the supplied fields.
49
+
50
+ ### Get context
51
+
52
+ ```json
53
+ {
54
+ "task": "trace the OAuth callback and its tests",
55
+ "depth": "focused",
56
+ "includeContent": false
57
+ }
58
+ ```
59
+
60
+ Depth controls the token and file budget:
61
+
62
+ | Depth | Token budget | File limit |
63
+ | --- | ---: | ---: |
64
+ | `minimal` | 4,000 | 12 |
65
+ | `focused` | 16,000 | 40 |
66
+ | `broad` | 40,000 | 100 |
67
+
68
+ Start without content. Review the selected paths and reasons, then request content only when needed.
69
+
70
+ ### Get selected content
71
+
72
+ ```json
73
+ {
74
+ "contextPackId": "context-pack-id",
75
+ "paths": ["src/oauth.ts", "tests/oauth.spec.ts"],
76
+ "maxTokens": 8000
77
+ }
78
+ ```
79
+
80
+ Each path must belong to the referenced Context Pack and remain inside the workspace. Omit `paths` to read all selected files within the token budget.
81
+
82
+ ## Recommended agent sequence
83
+
84
+ 1. Request a focused Context Pack for the task.
85
+ 2. Read only the selected content needed for the change.
86
+ 3. Make and test the change with the normal project tools.
87
+ 4. Generate a Review Pack.
88
+ 5. Capture Failure Evidence only for commands that actually failed.
89
+ 6. Report completed checks separately from suggested checks.
90
+
91
+ ## Stored artifacts
92
+
93
+ The plugin stores the latest normalized artifact in Paperclip plugin state for its project, issue, or run scope. It does not write reports into the project workspace.
94
+
95
+ Schemas are published in `schemas/`. Consumers should ignore unknown fields added by compatible future releases.
@@ -0,0 +1,20 @@
1
+ # Agent workflow
2
+
3
+ Ask the agent to select context before broad reading:
4
+
5
+ ```text
6
+ Use kujolang.paperclip:get-context with task "trace the OAuth callback" and depth "focused".
7
+ Read only the selected files needed for the task.
8
+ ```
9
+
10
+ After the change, request a Review Pack:
11
+
12
+ ```text
13
+ Use kujolang.paperclip:review-changes. Report suggested checks as suggestions unless you ran them.
14
+ ```
15
+
16
+ If a command fails, save bounded evidence without rerunning it:
17
+
18
+ ```text
19
+ Use kujolang.paperclip:capture-failure with the command, exit code, and relevant log excerpt.
20
+ ```
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "@kujolang/paperclip",
3
+ "version": "0.1.0",
4
+ "description": "Make Paperclip agent work easier to scope, review, reproduce, and verify.",
5
+ "license": "MIT",
6
+ "homepage": "https://github.com/kujolang/paperclip#readme",
7
+ "bugs": { "url": "https://github.com/kujolang/paperclip/issues" },
8
+ "repository": { "type": "git", "url": "git+https://github.com/kujolang/paperclip.git" },
9
+ "type": "module",
10
+ "engines": {
11
+ "node": ">=24.11.0"
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "bundled",
16
+ "docs",
17
+ "examples",
18
+ "schemas",
19
+ "skills",
20
+ "CHANGELOG.md",
21
+ "README.md",
22
+ "SECURITY.md",
23
+ "VERSION",
24
+ "LICENSE"
25
+ ],
26
+ "paperclipPlugin": {
27
+ "manifest": "./dist/manifest.js",
28
+ "worker": "./dist/worker.js",
29
+ "ui": "./dist/ui"
30
+ },
31
+ "scripts": {
32
+ "build": "node esbuild.config.mjs",
33
+ "typecheck": "tsc --noEmit",
34
+ "test": "vitest run",
35
+ "test:watch": "vitest",
36
+ "components:sync": "node scripts/sync-components.mjs --local-root ..",
37
+ "components:verify": "node scripts/verify-components.mjs",
38
+ "repository:verify": "node scripts/verify-repository.mjs",
39
+ "supply-chain:verify": "node scripts/verify-supply-chain.mjs",
40
+ "verify": "npm run repository:verify && npm run typecheck && npm test && npm run components:verify && npm run supply-chain:verify && npm run build && npm run pack:verify",
41
+ "pack:verify": "node scripts/verify-package.mjs",
42
+ "release:dry-run": "npm run verify",
43
+ "prepublishOnly": "npm run verify"
44
+ },
45
+ "dependencies": {
46
+ "@kujolang/kujo-runtime": "1.2.2",
47
+ "@paperclipai/plugin-sdk": "2026.824.1",
48
+ "zod": "4.4.3"
49
+ },
50
+ "peerDependencies": {
51
+ "react": ">=18"
52
+ },
53
+ "peerDependenciesMeta": {
54
+ "react": {
55
+ "optional": true
56
+ }
57
+ },
58
+ "devDependencies": {
59
+ "@types/node": "24.0.0",
60
+ "@types/react": "19.2.0",
61
+ "esbuild": "0.28.2",
62
+ "react": "19.1.1",
63
+ "rollup": "4.62.4",
64
+ "typescript": "5.9.2",
65
+ "vitest": "4.1.10"
66
+ },
67
+ "publishConfig": {
68
+ "access": "public",
69
+ "provenance": true
70
+ }
71
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://kujolang.ai/schemas/paperclip/changebucket-analysis-v1.json",
4
+ "type": "object",
5
+ "required": ["base", "head", "summary", "categories", "files"],
6
+ "properties": {
7
+ "base": { "type": "string" },
8
+ "head": { "type": "string" },
9
+ "summary": {
10
+ "type": "object",
11
+ "required": ["files_changed", "lines_added", "lines_deleted", "total_churn", "risk_level"],
12
+ "properties": {
13
+ "files_changed": { "type": "integer", "minimum": 0 },
14
+ "lines_added": { "type": "integer", "minimum": 0 },
15
+ "lines_deleted": { "type": "integer", "minimum": 0 },
16
+ "total_churn": { "type": "integer", "minimum": 0 },
17
+ "risk_level": { "enum": ["low", "medium", "high"] }
18
+ },
19
+ "additionalProperties": true
20
+ },
21
+ "categories": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } },
22
+ "files": { "type": "array" }
23
+ },
24
+ "additionalProperties": true
25
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://kujolang.ai/schemas/paperclip/context-pack-v1.json",
4
+ "type": "object",
5
+ "required": ["schemaVersion", "id", "generatedAt", "task", "depth", "budget", "estimatedTokens", "files", "workspaceId", "projectId", "snapshot", "stale", "cacheKey", "provenance"],
6
+ "properties": {
7
+ "schemaVersion": { "const": 1 },
8
+ "id": { "type": "string", "pattern": "^context_" },
9
+ "generatedAt": { "type": "string", "format": "date-time" },
10
+ "task": { "type": "string", "minLength": 1 },
11
+ "depth": { "enum": ["minimal", "focused", "broad"] },
12
+ "budget": { "type": "integer", "minimum": 1 },
13
+ "estimatedTokens": { "type": "integer", "minimum": 0 },
14
+ "files": { "type": "array" },
15
+ "workspaceId": { "type": "string" },
16
+ "projectId": { "type": "string" },
17
+ "snapshot": { "type": "object" },
18
+ "stale": { "type": "boolean" },
19
+ "cacheKey": { "type": "string" },
20
+ "provenance": { "type": "object" }
21
+ },
22
+ "additionalProperties": true
23
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://kujolang.ai/schemas/paperclip/failure-evidence-v1.json",
4
+ "type": "object",
5
+ "required": ["schemaVersion", "id", "capturedAt", "context", "failure", "environment", "evidence", "redaction", "provenance"],
6
+ "properties": {
7
+ "schemaVersion": { "const": 1 },
8
+ "id": { "type": "string", "pattern": "^failure_" },
9
+ "capturedAt": { "type": "string", "format": "date-time" },
10
+ "context": { "type": "object" },
11
+ "failure": { "type": "object" },
12
+ "environment": { "type": "array" },
13
+ "evidence": { "type": "array" },
14
+ "redaction": { "type": "object" },
15
+ "provenance": { "type": "object" }
16
+ },
17
+ "additionalProperties": false
18
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://kujolang.ai/schemas/paperclip/review-pack-v1.json",
4
+ "type": "object",
5
+ "required": ["schemaVersion", "id", "generatedAt", "projectId", "workspaceId", "source", "footprint", "componentStatus", "stale", "provenance"],
6
+ "properties": {
7
+ "schemaVersion": { "const": 1 },
8
+ "id": { "type": "string", "pattern": "^review_" },
9
+ "generatedAt": { "type": "string", "format": "date-time" },
10
+ "projectId": { "type": "string" },
11
+ "workspaceId": { "type": "string" },
12
+ "source": { "type": "object" },
13
+ "footprint": { "type": "object" },
14
+ "componentStatus": { "type": "object" },
15
+ "stale": { "type": "boolean" },
16
+ "provenance": { "type": "object" }
17
+ },
18
+ "additionalProperties": true
19
+ }
@@ -0,0 +1,9 @@
1
+ ---
2
+ name: scoped-repository-context
3
+ description: Request a bounded, task-specific repository Context Pack before broad exploration.
4
+ ---
5
+
6
+ Before broad repository exploration, request a focused Context Pack for the task.
7
+ Start from the returned file list and selection reasons. Expand only when evidence
8
+ shows that context is missing. Do not request broad context by default.
9
+