@zalom/plastic 1.0.0-alpha.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.
Files changed (54) hide show
  1. package/LICENSE +21 -0
  2. package/PLASTIC.md +534 -0
  3. package/README.md +88 -0
  4. package/agents/future-intent-researcher.md +38 -0
  5. package/agents/intent-curator.md +40 -0
  6. package/bin/install.js +29 -0
  7. package/deprecations.yml +23 -0
  8. package/hooks/check-update +42 -0
  9. package/hooks/continue +31 -0
  10. package/hooks/future-intent-check +25 -0
  11. package/hooks/gate-check +10 -0
  12. package/hooks/hooks.json +78 -0
  13. package/hooks/run-hook +7 -0
  14. package/hooks/savepoint +6 -0
  15. package/hooks/session-start +9 -0
  16. package/hooks/statusline +16 -0
  17. package/package.json +43 -0
  18. package/scripts/folgezettel-id +40 -0
  19. package/scripts/hash-intent +29 -0
  20. package/scripts/hook-continue +130 -0
  21. package/scripts/hook-future-intent-check +90 -0
  22. package/scripts/hook-gate-check +136 -0
  23. package/scripts/hook-session-start +224 -0
  24. package/scripts/install.rb +474 -0
  25. package/scripts/lib/bridge.rb +139 -0
  26. package/scripts/migrate-folgezettel +535 -0
  27. package/scripts/migrate-to-global +96 -0
  28. package/scripts/read-config +129 -0
  29. package/skills/auto/SKILL.md +127 -0
  30. package/skills/brainstorming-grill-me/SKILL.md +105 -0
  31. package/skills/continuing/SKILL.md +104 -0
  32. package/skills/creating-intent/SKILL.md +122 -0
  33. package/skills/creating-project/SKILL.md +166 -0
  34. package/skills/executing-plan/SKILL.md +120 -0
  35. package/skills/executing-plan/code-quality-reviewer-prompt.md +32 -0
  36. package/skills/executing-plan/implementer-prompt.md +42 -0
  37. package/skills/executing-plan/spec-reviewer-prompt.md +27 -0
  38. package/skills/install/SKILL.md +134 -0
  39. package/skills/intent-curator/SKILL.md +41 -0
  40. package/skills/linking-intents/SKILL.md +72 -0
  41. package/skills/managing-index/SKILL.md +66 -0
  42. package/skills/managing-index/references/zettelkasten-linking.md +27 -0
  43. package/skills/releasing/SKILL.md +124 -0
  44. package/skills/savepoint/SKILL.md +57 -0
  45. package/skills/uninstall/SKILL.md +48 -0
  46. package/skills/update/SKILL.md +69 -0
  47. package/templates/agents.md +46 -0
  48. package/templates/checklist.md +11 -0
  49. package/templates/config.yml +13 -0
  50. package/templates/index.md +13 -0
  51. package/templates/intent.md +24 -0
  52. package/templates/plan.md +11 -0
  53. package/templates/projects.yml +3 -0
  54. package/templates/savepoint.md +13 -0
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: plastic:managing-index
3
+ description: Use after creating, completing, or abandoning intents, when the user says "index" or "organize", or when INDEX.md needs maintenance. Curates the INDEX.md structure note.
4
+ ---
5
+
6
+ # Managing the Index
7
+
8
+ ## When to Use
9
+ - After creating a new intent (automatic — part of creating-intent workflow)
10
+ - After completing or abandoning an intent
11
+ - User says "index", "organize", or "clean up"
12
+ - Periodic maintenance when the store grows
13
+
14
+ ## INDEX.md Structure
15
+
16
+ INDEX.md is a Zettelkasten main structure note — the brain's entry point. It has four sections:
17
+
18
+ ### Active
19
+ Intents currently being worked on. Max 1-2 for focus.
20
+ ```markdown
21
+ ## Active
22
+ - [1a2 — Design Plastic](store/1a2--design-plastic-state-system/1a2.md) — decision, human
23
+ ```
24
+
25
+ ### Future
26
+ Intents parked for later. May be picked up by agents.
27
+ ```markdown
28
+ ## Future
29
+ - [1b1 — Build Reddit KB](store/1b1--build-reddit-knowledge-base/1b1.md) — implementation, human
30
+ ```
31
+
32
+ ### Clusters
33
+ Topic-based groupings. Manually curated. Create a new cluster when 3+ intents share a topic.
34
+ ```markdown
35
+ ## Clusters
36
+ ### Reddit Knowledge Base
37
+ - [1a — Research](store/1a--research-reddit-saved-posts/1a.md)
38
+ - [1a1 — Plan](store/1a1--plan-reddit-knowledge-base/1a1.md)
39
+ ```
40
+
41
+ ### Completed
42
+ All completed intents with dates. Links preserved, never deleted.
43
+
44
+ ## Workflow
45
+
46
+ ### Rebuild Sections
47
+ Scan the active store's `store/` directory for intent files and rebuild each section:
48
+
49
+ ```bash
50
+ for dir in $STORE_ROOT/store/*/; do
51
+ f=$(find "$dir" -maxdepth 1 -name "*.md" ! -name "spec.md" ! -name "plan.md" ! -name "checklist.md" ! -name "outcome.md" ! -name "savepoint.md" | head -1)
52
+ [ -n "$f" ] && dirname_slug=$(basename "$dir") && ruby -e '
53
+ data = File.read(ARGV[0]).split("---")[1]
54
+ parsed = YAML.safe_load(data)
55
+ puts "#{parsed["id"]}|#{parsed["intent"]}|#{ARGV[1]}"
56
+ ' "$f" "$dirname_slug" 2>/dev/null
57
+ done | sort -t'|' -k1
58
+ ```
59
+
60
+ ### Suggest Clusters
61
+ When 3+ intents share tags but aren't in a cluster, suggest a new cluster heading.
62
+
63
+ ### Flag Orphans
64
+ Intents with no links (empty `sources`, empty `chain`, no `## Links` entries, not in any cluster) should be flagged for curation.
65
+
66
+ REQUIRED BACKGROUND: linking-intents (for understanding connection types and Zettelkasten theory)
@@ -0,0 +1,27 @@
1
+ # Zettelkasten Linking Reference
2
+
3
+ ## Three Structural Layers
4
+
5
+ 1. **Content notes** — individual intents (`~/.plastic/store/ID--slug/ID--slug.md`)
6
+ 2. **Structure notes** — INDEX.md clusters that organize related intents
7
+ 3. **Main structure note** — INDEX.md itself, the top-level entry point
8
+
9
+ ## Three Connection Types (Ranked)
10
+
11
+ 1. **Direct links** (strongest) — wikilinks in `## Links` section
12
+ 2. **Sources/Chain** (knowledge graph) — `sources` array (backward), `chain` array (forward) in frontmatter
13
+ 3. **Tags** (weakest) — shared tags, `project-<name>` for project membership
14
+
15
+ ## When to Create a Cluster
16
+
17
+ A cluster is a structure note heading. Create one when:
18
+ - 3+ intents share a topic but aren't grouped
19
+ - You notice a pattern across intents
20
+ - A topic area is growing and needs an entry point
21
+
22
+ ## Principles
23
+
24
+ - Links are the primary organizational mechanism, not folders
25
+ - Structure is a lens, not a container — intents remain first-class citizens
26
+ - Clusters are manually curated, not auto-generated
27
+ - Facts are invalidated, never deleted — completed intents stay in INDEX.md
@@ -0,0 +1,124 @@
1
+ ---
2
+ name: plastic:releasing
3
+ description: Use when merging a feature branch to main and tagging a release, bumping the version, or when the user says "release", "tag", or "ship it"
4
+ ---
5
+
6
+ # Releasing
7
+
8
+ Merge, bump, tag, push. Annotated tags with changelogs. Semantic versioning.
9
+
10
+ ## Checklist
11
+
12
+ - [ ] All tests pass
13
+ - [ ] Merge feature branch to main
14
+ - [ ] Bump version in plugin.json and marketplace.json
15
+ - [ ] Commit version bump
16
+ - [ ] Create annotated tag
17
+ - [ ] Push to remote with tags
18
+
19
+ ## Workflow
20
+
21
+ ### 1. Verify Tests Pass
22
+
23
+ ```bash
24
+ ruby test/read_config_test.rb && ruby test/config_template_test.rb
25
+ ```
26
+
27
+ All tests must pass before release. Do not proceed if any fail.
28
+
29
+ ### 2. Determine Version Bump
30
+
31
+ | Change type | Bump | Example |
32
+ |-------------|------|---------|
33
+ | Breaking changes | Major | 0.x.0 → 1.0.0 |
34
+ | New features | Minor | 0.3.0 → 0.4.0 |
35
+ | Bug fixes only | Patch | 0.4.0 → 0.4.1 |
36
+
37
+ Pre-1.0: minor bumps for features, patch for fixes. No major until stable.
38
+
39
+ ### 3. Merge Feature Branch
40
+
41
+ ```bash
42
+ git checkout main
43
+ git merge <branch-name> --no-ff -m "feat: merge intent [ID] — [description]"
44
+ ```
45
+
46
+ Always `--no-ff` to preserve branch history in the merge commit.
47
+
48
+ ### 4. Bump Version
49
+
50
+ Update ALL THREE files — they must stay in sync:
51
+ - `package.json` → `"version": "X.Y.Z"`
52
+ - `.claude-plugin/plugin.json` → `"version": "X.Y.Z"`
53
+ - `.claude-plugin/marketplace.json` → `"version": "X.Y.Z"`
54
+
55
+ ```bash
56
+ git add package.json .claude-plugin/plugin.json .claude-plugin/marketplace.json
57
+ git commit -m "chore: bump version to X.Y.Z — [one-line summary]"
58
+ ```
59
+
60
+ ### 5. Create Annotated Tag
61
+
62
+ Generate the changelog from commits since the last tag:
63
+
64
+ ```bash
65
+ git log $(git describe --tags --abbrev=0)..HEAD --oneline --no-merges | grep -E "^[a-f0-9]+ (feat|fix|refactor):"
66
+ ```
67
+
68
+ Create the tag with a multi-line message:
69
+
70
+ ```bash
71
+ git tag -a vX.Y.Z -m "vX.Y.Z — [release name]
72
+
73
+ - [changelog bullet points from feat/fix/refactor commits]"
74
+ ```
75
+
76
+ ### 6. Push
77
+
78
+ ```bash
79
+ git push origin main --tags
80
+ ```
81
+
82
+ ### 7. GitHub Release
83
+
84
+ Create a GitHub release from the tag. Use `--generate-notes` to auto-generate changelog from commits since the previous tag:
85
+
86
+ ```bash
87
+ gh release create vX.Y.Z --title "vX.Y.Z — [release name]" --generate-notes --notes-start-tag <previous-tag>
88
+ ```
89
+
90
+ For the first release (no previous tag), write notes manually with `--notes "..."` instead.
91
+
92
+ ### 8. Complete Active Intent
93
+
94
+ A release IS a delivery. The active intent that drove this work must be completed as part of the release process. This is NOT optional.
95
+
96
+ 1. Read `~/.plastic/INDEX.md` → find active intent(s) related to this release
97
+ 2. For each active intent being delivered:
98
+ a. Write `outcome.md` with detailed results
99
+ b. Write `## Outcome` summary in the intent file (reference the release tag)
100
+ c. Update `## Insights` with final observations
101
+ d. Move from `## Active` to `## Completed` in INDEX.md (with today's date)
102
+ e. Update clusters to show `_(completed)_`
103
+ 3. Auto-commit: `cd ~/.plastic && git add . && git commit -m "feat: complete intent <ID> — delivered in v<X.Y.Z>"`
104
+
105
+ **If no active intent exists for this release**, that itself is a problem — work happened outside the intent system. Log it and move on, but flag it.
106
+
107
+ ## Conventions
108
+
109
+ - **Annotated tags only** — `git tag -a`, never lightweight tags
110
+ - **Tag format** — `vX.Y.Z` (lowercase v prefix)
111
+ - **Tag message** — first line: `vX.Y.Z — [short name]`, then blank line, then bullet changelog
112
+ - **Commit prefixes** — `feat:`, `fix:`, `refactor:`, `chore:`, `docs:` (conventional commits)
113
+ - **Version files** — package.json, plugin.json, and marketplace.json always match
114
+ - **Branch cleanup** — delete merged feature branches: `git branch -d <branch>`
115
+
116
+ ## Retroactive Tagging
117
+
118
+ For repos without prior tags, tag historical releases:
119
+
120
+ ```bash
121
+ git tag -a v0.1.0 <commit-sha> -m "v0.1.0 — [description]"
122
+ ```
123
+
124
+ Use `git log --oneline` to find the right commits (look for version bump commits or major feature merges).
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: plastic:savepoint
3
+ description: Use when context is being compacted (PreCompact hook), user says "save" or "savepoint", or before ending a session. Saves the active intent's state so work can resume after /clear.
4
+ ---
5
+
6
+ # Savepoint
7
+
8
+ ## When to Use
9
+ - PreCompact hook fires (automatic)
10
+ - User says "save", "savepoint", or "save progress"
11
+ - Before ending a long session
12
+ - Before switching to a different intent
13
+
14
+ ## Workflow
15
+
16
+ ### 1. Find Active Intent(s)
17
+ Read `~/.plastic/INDEX.md` (or the project INDEX.md) and extract all intents listed under `## Active`.
18
+
19
+ ### 2. For Each Active Intent
20
+ Read the intent directory at `~/.plastic/store/ID--slug/`:
21
+
22
+ **a. Update checklist.md** (if exists):
23
+ - Check off completed items
24
+ - Add any new items discovered during the session
25
+
26
+ **b. Create/update savepoint.md:**
27
+ ```markdown
28
+ # Savepoint
29
+
30
+ ## Last Updated
31
+ {{DATE}} — Session #{{N}}
32
+
33
+ ## In Progress
34
+ - (what was being worked on when savepoint triggered)
35
+ - Next: (immediate next step)
36
+
37
+ ## Blockers
38
+ (any blockers or open questions)
39
+
40
+ ## Key Discoveries This Session
41
+ - (important things learned)
42
+ ```
43
+
44
+ **c. Update `{ID}--{slug}.md`:**
45
+ - Add observations to `## Insights` section
46
+
47
+ ### 3. Update INDEX.md
48
+ Verify the `## Active` section is accurate.
49
+
50
+ ### 4. Commit
51
+ ```bash
52
+ git add .plastic/
53
+ git commit -m "chore: savepoint — [active intent name]"
54
+ ```
55
+
56
+ ### 5. Notify User
57
+ Tell the user: "Context is getting large. I've saved progress to intent [ID] — [name]. Please run `/clear` and say `continue` to resume."
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: plastic:uninstall
3
+ description: Use when the user wants to remove Plastic. Deregisters the plugin from the current agent (Claude Code, Cursor, etc.) and optionally deletes all data.
4
+ ---
5
+
6
+ # Uninstall Plastic
7
+
8
+ ## Procedure
9
+
10
+ ### Step 1: Detect the current agent
11
+
12
+ Check environment variables to determine which agent is running:
13
+ - `$CLAUDE_PLUGIN_ROOT` → Claude Code
14
+ - `$CURSOR_PLUGIN_ROOT` → Cursor
15
+ - Otherwise → unknown agent
16
+
17
+ ### Step 2: Deregister from the agent
18
+
19
+ **Claude Code:**
20
+ - Remove `"plastic"` from `extraKnownMarketplaces` in `~/.claude/settings.json`
21
+ - Remove `"plastic@plastic"` from `enabledPlugins` in `~/.claude/settings.json`
22
+ - Announce: "Plastic deregistered from Claude Code."
23
+
24
+ **Other agents:** Provide manual instructions for their deregistration process.
25
+
26
+ ### Step 3: Offer the data decision
27
+
28
+ Present clearly:
29
+
30
+ ```
31
+ Plastic is deregistered from [agent name].
32
+
33
+ Your intent store at ~/.plastic/ is untouched.
34
+
35
+ Would you like to delete your Plastic data now?
36
+
37
+ ⚠️ WARNING: This permanently removes ALL intents, history,
38
+ and any projects in ~/.plastic/projects/.
39
+ This is irreversible.
40
+
41
+ a) Keep everything (recommended) — you can re-install Plastic later
42
+ b) Delete everything now — removes ~/.plastic/ entirely
43
+ ```
44
+
45
+ ### Step 4: Execute user's choice
46
+
47
+ - **Keep:** Done. Tell the user: "Your data is at ~/.plastic/. Re-install anytime with `/plastic:install`."
48
+ - **Delete:** Run `rm -rf ~/.plastic/` and confirm: "Plastic data deleted."
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: update
3
+ description: Use when updating Plastic after a plugin update, or when the user says "update plastic". Runs the npx installer to sync core files and re-register agent adapters.
4
+ ---
5
+
6
+ # Update Plastic
7
+
8
+ ## When to Use
9
+ - User says "update plastic", "sync plastic", or "upgrade plastic"
10
+ - Statusline shows "Plastic update available"
11
+ - After a version bump notification
12
+
13
+ ## Prerequisites
14
+
15
+ Global install must exist (`~/.plastic/INDEX.md` present). If not, tell the
16
+ user to run `npx @zalom/plastic@latest` first.
17
+
18
+ ## Procedure
19
+
20
+ ### Step 1: Verify global install exists
21
+
22
+ ```bash
23
+ if [ ! -f ~/.plastic/INDEX.md ]; then
24
+ echo "No global install found. Run: npx @zalom/plastic@latest"
25
+ exit
26
+ fi
27
+ ```
28
+
29
+ ### Step 2: Run the installer
30
+
31
+ ```bash
32
+ npx @zalom/plastic@latest --claude
33
+ ```
34
+
35
+ This re-runs the installer which:
36
+ - Downloads the latest version from npm
37
+ - Syncs core files (PLASTIC.md, scripts, hooks) to ~/.plastic/
38
+ - Re-registers hooks and skills into Claude Code's ~/.claude/
39
+ - Preserves all user data (INDEX.md, config.yml, projects.yml, store/)
40
+
41
+ ### Step 3: Announce key changes
42
+
43
+ After the installer completes, read `~/.plastic/PLASTIC.md` and announce any
44
+ convention changes that affect the current session. This corrects the agent's
45
+ in-context understanding without needing /clear.
46
+
47
+ Format:
48
+ ```
49
+ Plastic updated to vX.Y.Z.
50
+
51
+ Key changes in this version:
52
+ - [list notable convention changes if any]
53
+
54
+ Recommendation: run /clear for a clean session with all new conventions loaded.
55
+ ```
56
+
57
+ ### Step 4: Commit
58
+
59
+ ```bash
60
+ cd ~/.plastic && git add PLASTIC.md scripts/ AGENTS.md VERSION 2>/dev/null && git commit -m "chore: update Plastic core files" --allow-empty
61
+ ```
62
+
63
+ ### Step 5: Clear update cache
64
+
65
+ ```bash
66
+ rm -f ~/.plastic/.cache/update-check.json
67
+ ```
68
+
69
+ This removes the statusline warning since the update is now applied.
@@ -0,0 +1,46 @@
1
+ # Plastic — Project Agent Instructions
2
+
3
+ > Full conventions: see `~/.plastic/PLASTIC.md` (the global conventions contract).
4
+ > This file covers project-scoped rules only.
5
+
6
+ ## Your Role
7
+
8
+ You are working on this project as part of a strategic intent. Your governing intent is tracked in the global Plastic store at `~/.plastic/store/`.
9
+
10
+ ## How to Work
11
+
12
+ 1. **Check active tactical intents** in `.plastic/store/` — these are your current tasks
13
+ 2. **Create new tactical intents** when you discover sub-work needed
14
+ 3. **Use [[ID]] wikilinks** to link intents to each other
15
+ 4. **Use [[global:ID]]** to link back to the governing strategic intent
16
+ 5. **Auto-commit** all intent changes in this project's git repo
17
+
18
+ ## Intent Lifecycle — What→Why→How→Next
19
+
20
+ State is derived from filesystem conventions, not frontmatter fields:
21
+
22
+ | Convention | Signal |
23
+ |---|---|
24
+ | `## Context` has content | Intent is permanent (not fleeting) |
25
+ | `actions/` directory exists | Intent is actionable |
26
+ | `## Outcome` has content | Intent is done |
27
+
28
+ Sections map to the lifecycle:
29
+ - **## Intent** — What (the desire)
30
+ - **## Context** — Why (background + ### Decisions)
31
+ - **## Outcome** — How (the result, deliverables)
32
+ - **## Insights** — Next (observations, raw material for future intents)
33
+
34
+ Active/Future/Completed placement is managed in INDEX.md, not in frontmatter.
35
+
36
+ ## Creating Tactical Intents
37
+
38
+ 1. Scan `.plastic/store/` for the next sequential ID
39
+ 2. Generate ID: `~/.plastic/scripts/folgezettel-id`
40
+ 3. Create `.plastic/store/ID--slug/ID--slug.md`
41
+ 4. Set frontmatter: `id`, `intent`, `sources` (array — link to governing intent), `chain` (starts empty), `created`, `author`, `tags`
42
+ 5. Add `[[global:ID]]` backlink in `## Links`
43
+
44
+ ## When You're Done
45
+
46
+ When this project satisfies the governing intent's goal, report back. The orchestrator will complete the strategic intent.
@@ -0,0 +1,11 @@
1
+ # Checklist: {{INTENT_NAME}}
2
+
3
+ ## In Progress
4
+ - [ ] ...
5
+
6
+ ## Completed
7
+ (move items here when done)
8
+
9
+ ## Session Log
10
+ | Date | Items Completed | Notes |
11
+ |------|-----------------|-------|
@@ -0,0 +1,13 @@
1
+ version: 3
2
+ project_roots:
3
+ - ~/.plastic/projects
4
+ stale_threshold_days: 3
5
+ execution_mode: subagent-driven
6
+ hash_length: 6
7
+ hash_algorithm: sha256-base36
8
+ max_slug_words: 5
9
+ agent:
10
+ type: claude-code
11
+ parallel_mode: linear
12
+ architect:
13
+ style:
@@ -0,0 +1,13 @@
1
+ # Index
2
+
3
+ ## Active
4
+ (no active intents)
5
+
6
+ ## Future
7
+ (no future intents)
8
+
9
+ ## Clusters
10
+ (clusters emerge as intents accumulate — add headings when 3+ intents share a topic)
11
+
12
+ ## Completed
13
+ (links preserved, never deleted)
@@ -0,0 +1,24 @@
1
+ ---
2
+ id: "{{ID}}"
3
+ intent: "{{INTENT}}"
4
+ sources: [{{SOURCES}}]
5
+ chain: []
6
+ created: {{DATE}}
7
+ author: {{AUTHOR}}
8
+ tags: [{{TAGS}}]
9
+ ---
10
+
11
+ ## Intent
12
+ {{DESCRIPTION}}
13
+
14
+ ## Context
15
+ (why this intent exists — background, then ### Decisions after brainstorming)
16
+
17
+ ## Outcome
18
+ (the result — implementation details, deliverables)
19
+
20
+ ## Insights
21
+ (observations captured throughout — raw material for future intents)
22
+
23
+ ## Links
24
+ - (use [[ID]] or [[ID|display text]] wikilinks to related intents)
@@ -0,0 +1,11 @@
1
+ # Plan: {{INTENT_NAME}}
2
+
3
+ ## Goal
4
+ {{GOAL}}
5
+
6
+ ## Steps
7
+ - [ ] Step 1 — ...
8
+ - [ ] Step 2 — ...
9
+
10
+ ## Notes
11
+ (implementation notes, constraints, decisions)
@@ -0,0 +1,3 @@
1
+ # Plastic project registry
2
+ # Maps project slugs to paths and parent intents
3
+ projects: {}
@@ -0,0 +1,13 @@
1
+ # Savepoint
2
+
3
+ ## Last Updated
4
+ {{DATE}} — Session #{{N}}
5
+
6
+ ## In Progress
7
+ - ...
8
+
9
+ ## Blockers
10
+ None
11
+
12
+ ## Key Discoveries This Session
13
+ - ...