Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .omp-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
},
"metadata": {
"description": "pstack, poteto's engineering methodology for Cursor, ported to oh-my-pi. Model and provider agnostic.",
"version": "0.15.4800"
"version": "0.15.4801"
},
"plugins": [
{
"name": "pstack",
"description": "60 skills, 22 playbooks, 24 principles, the poteto-mode pin, and two agents. Upstream cursor/plugins pstack 0.15.48 at 9e278fe.",
"version": "0.15.4800",
"version": "0.15.4801",
"category": "development",
"license": "MIT",
"source": "./plugins/pstack"
Expand Down
19 changes: 19 additions & 0 deletions PORTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,25 @@ unified diffs applied after the rules, which is where a change no substitution c
and runtime contract. `omp-mechanics` keeps only pstack-specific OMP deltas. Upstream syncs preserve
these paths without rewriting them.

### Skill commands are derived, not listed

omp registers each skill only as `/skill:<name>`. A bare `/how` reaches the model as literal text and
never loads the skill, so every `/name` upstream writes has to become `/skill:name`. One rule in
`rules.sed` does it, and its left side carries the token `@skill-names@` instead of a list of
skills. `apply_rules` replaces the token with every directory under the tree's `skills/`, plus the
owned skills in `owned.txt`, minus `poteto-mode`, so a skill upstream adds is covered by the build
that brings it in and nobody edits a rule or a README. `poteto-mode` is a real extension command
that the port registers itself, so its bare form stays as upstream wrote it. The probes that read
`rules.sed` as data expand the token the same way.

A name is rewritten after the start of a line, a space, `(`, a backtick, or `"`, when the next
character cannot continue a name, a path, or a longer name (a letter, digit, `_`, `/`, or `-`).
Paths, URLs, `skill://name`, `/how-to`, and `/reframed` are left alone. The rule consumes the one
character after the name, so two names a single space apart rewrite only the first. The
`skill command form` check uses the same boundaries with lookaround, so that line fails the gate
instead of shipping. The READMEs carry no skill, playbook, or principle counts for the same reason.
`marketplace.json` carries them, written by the build, and `counts` holds it to the live tree.

`omp-port/excluded.txt` names upstream paths the port does not ship, one per line. `extract_upstream`
deletes each one right after the export, so no rule, patch, or probe sees that text, and a rule that
only an excluded file matched reads as stale. The `excluded paths` check fails when an excluded path
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
pstack-omp ports Lauren Tan's [pstack](https://github.com/cursor/plugins/tree/main/pstack) from
Cursor to [oh-my-pi](https://github.com/can1357/oh-my-pi) (`omp`). It is for omp users who want
pstack's `poteto-mode` router, its playbooks for bug fixes, features, reviews, and shipping, and its
review panels. The plugin carries 60 skills, with 22 playbooks and 24 principle leaves, and two
extensions.
review panels. The plugin carries the full pstack skill set, its playbooks and principle leaves,
and two extensions.

## Install

Expand Down
2 changes: 1 addition & 1 deletion omp-port/RELEASE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0
1
30 changes: 13 additions & 17 deletions omp-port/check-port.sh
Original file line number Diff line number Diff line change
Expand Up @@ -233,17 +233,18 @@ runtime_contract() {
report "cursor tool names" "PASS no Cursor tool name, capitalised Task included"
fi

# Derived from the tree, not from a list: a hand-kept list of names is a list that forgets.
bare=""
while read -r n; do
hits=$(grep -rInF "\`/$n\`" --include='*.md' "${SCOPE[@]}" 2>/dev/null || true)
[ -n "$hits" ] && bare="$bare$hits"$'\n'
done < <(find skills -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | sort)
if [ -n "$bare" ]; then
report "skill command form" "FAIL"
while read -r line; do [ -n "$line" ] && violate "$line"; done <<<"$bare"
if names=$(skill_names_alt .); then
bare=$(grep -rInP "(?<![^ (\\x60\"])/($names)(?![A-Za-z0-9_/-])" --include='*.md' "${SCOPE[@]}" 2>/dev/null || true)
if [ -n "$bare" ]; then
report "skill command form" "FAIL"
while read -r line; do [ -n "$line" ] && violate "$line"; done <<<"$bare"
else
report "skill command form" "PASS every skill command uses the registered /skill:<name> form"
fi
else
report "skill command form" "PASS every skill command uses the registered /skill:<name> form"
report "skill command form" "FAIL"
violate "no skill names to check under skills/"
fi

bad=""
Expand Down Expand Up @@ -615,18 +616,13 @@ else
report "conflict markers" "PASS no unresolved merge left"
fi

# The counts are generated by omp-port/sync-upstream.sh into marketplace.json. The two READMEs
# carry them by hand, so they rot silently unless the live tree is the judge. "principle" with no
# trailing s so it matches both "principles" and "principle leaves".
read -r nskills nplays nprinc < <(port_counts .)
MARKET=../../.omp-plugin/marketplace.json
pin7=$(cut -c1-7 ../../omp-port/UPSTREAM)
stale=""
for f in ../../README.md README.md "$MARKET"; do
grep -qF "$nskills skills" "$f" 2>/dev/null || stale="$stale$f wants \"$nskills skills\""$'\n'
grep -qF "$nplays playbooks" "$f" 2>/dev/null || stale="$stale$f wants \"$nplays playbooks\""$'\n'
grep -qF "$nprinc principle" "$f" 2>/dev/null || stale="$stale$f wants \"$nprinc principle\""$'\n'
done
grep -qF "$nskills skills" "$MARKET" 2>/dev/null || stale="$stale$MARKET wants \"$nskills skills\""$'\n'
grep -qF "$nplays playbooks" "$MARKET" 2>/dev/null || stale="$stale$MARKET wants \"$nplays playbooks\""$'\n'
grep -qF "$nprinc principles" "$MARKET" 2>/dev/null || stale="$stale$MARKET wants \"$nprinc principles\""$'\n'
grep -qF " at $pin7." "$MARKET" 2>/dev/null ||
stale="$stale$MARKET wants the pinned sha \" at $pin7.\""$'\n'
if [ -n "$stale" ]; then
Expand Down
57 changes: 49 additions & 8 deletions omp-port/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,49 @@ extract_upstream() {
[ -d "$work/skills" ] && [ -d "$work/agents" ]
}

extension_commands() {
grep -rhoE 'registerCommand\("[a-z0-9-]+"' "$REPO_ROOT/plugins/pstack/extensions" --include=index.js |
sed -E 's/^registerCommand\("(.*)"$/\1/'
}

skill_command_names() {
{
find "$1/skills" -mindepth 1 -maxdepth 1 -type d -printf '%f\n'
owned_paths | sed -n 's#^skills/\([^/]*\)$#\1#p'
} | grep -E '^[a-z0-9][a-z0-9-]*$' | grep -vxF -f <(extension_commands) | LC_ALL=C sort -u
}

# The same names as one ERE alternation for the @skill-names@ token in rules.sed.
skill_names_alt() {
local list
list=$(skill_command_names "$1") && [ -n "$list" ] || {
printf 'no skill directories under %s/skills\n' "$1" >&2
return 1
}
paste -sd'|' - <<<"$list"
}

# <rules> with the @skill-names@ token replaced by the names of the skills in <tree>.
expand_rules() {
local alt
alt=$(skill_names_alt "$1") || return 1
sed "s#@skill-names@#$alt#g" "$2"
}

# Step 2, the substitution table. Binary files are skipped rather than corrupted, which is what
# grep -I reports when the empty pattern does not match. One sed takes a batch of files, and -i
# implies -s, so each file is still its own stream and a range address ends with its file.
# implies -s, so each file is still its own stream and a range address ends with its file. The
apply_rules() {
local work="$1" rules="$2"
grep -rIlZ '' "$work" |
xargs -0 -r -n 64 -P "$(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 2)" sed -E -i -f "$rules"
local work="$1" rules="$2" expanded st=0
expanded=$(mktemp) || return 1
if expand_rules "$work" "$rules" >"$expanded"; then
grep -rIlZ '' "$work" |
xargs -0 -r -n 64 -P "$(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 2)" sed -E -i -f "$expanded" || st=$?
else
st=1
fi
rm -f "$expanded"
return "$st"
}

# Step 3, the port's own code. A patch that no longer applies is a hard stop, because the
Expand Down Expand Up @@ -428,20 +464,25 @@ dead_rules() {
# Exits 1, printing nothing, when the extract or any rule fails to parse, so a caller cannot read
# an empty result as "nothing is stale".
dead_rule_causes() {
local sha="$1" dead="$2" work catchall n rule prog by span st=0
local sha="$1" dead="$2" work catchall n rule prog by span alt st=0
[ -n "$dead" ] || return 0
work=$(mktemp -d)
if ! mkdir "$work/up" || ! extract_upstream "$sha" "$work/up"; then
rm -rf "$work"
return 1
fi
text_blob "$work/up" >"$work/blob"
mark_rules >"$work/marked"
if ! alt=$(skill_names_alt "$work/up"); then
rm -rf "$work"
return 1
fi
mark_rules | sed "s#@skill-names@#$alt#g" >"$work/marked"
catchall=$(grep -nF "$CATCHALL_REPL" "$RULES" | head -n1 | cut -d: -f1)
declare -A progs
while IFS=$'\t' read -r n _ _ _ _ prog _; do progs[$n]=$prog; done < <(rule_table)
while IFS=$'\t' read -r n _ _ _ _ prog _; do progs[$n]=${prog//@skill-names@/$alt}; done < <(rule_table)
while IFS=$'\t' read -r n rule; do
[ -n "$n" ] || continue
rule=${rule//@skill-names@/$alt}
printf '%s\n' "${rule//$RULE_NL/$'\n'}" >"$work/rule.sed"
if ! sed -E -f "$work/rule.sed" "$work/blob" >"$work/out" 2>/dev/null; then
st=1
Expand All @@ -458,7 +499,7 @@ dead_rule_causes() {
prog=${progs[$n]:--}
if [ "$prog" != - ]; then
sed -nE "$prog" "$work/blob" | spans_of | LC_ALL=C sort -u >"$work/spans"
head -n "$((n - 1))" "$RULES" >"$work/prefix.sed"
head -n "$((n - 1))" "$RULES" | sed "s#@skill-names@#$alt#g" >"$work/prefix.sed"
sed -E -f "$work/prefix.sed" "$work/spans" >"$work/after"
if ! cmp -s "$work/spans" "$work/after"; then
head -n "$((n - 1))" "$work/marked" >"$work/prefix.sed"
Expand Down
20 changes: 3 additions & 17 deletions omp-port/rules.sed
Original file line number Diff line number Diff line change
Expand Up @@ -388,14 +388,9 @@ s#\[`/setup-pstack`\]#[Choose models]#g
s#\.\./setup-pstack/SKILL\.md#../omp-mechanics/SKILL.md\#choose-models#g
s#`/setup-pstack`#the Choose models section of `skill://omp-mechanics`#g
# omp registers one slash command per skill as /skill:<name>; a bare /how is not a command on this
# harness. `/poteto-mode` is in the alternation only because the gate scans for it like any other
# name; the port's own extension registers that command, so the rewrite is a no-op in practice.
#
# One rule covers every name rather than one rule per skill. The per-skill form was a list that
# forgot: upstream added eighteen skills after it was written and every one of them shipped a bare
# /name the gate could not accept. Adding a skill upstream now means adding its name to the
# alternation, once.
s#`/(teach|recall|reflect|reframe|tdd|swarm|arena|interrogate|correct|automate-me|figure-it-out|show-me-your-work|benchmark-checklist|blast-radius|ketchup-video|ketchup|bro|make-bot-ui|poteto-help|no-comments|unslop|create-verification-skill|maintain-verification-skill|create-formal-verification-skill|maintain-formal-verification-skill|statechart|architect|why|how|technical-writing|sharpen|in-your-own-words|typescript-best-practices|poteto-mode|principle-[a-z-]+)`#`/skill:\1`#g
# harness, and with `disable-model-invocation: true` the skill is hidden from the index, so the
# model cannot recover it either.
s#(^|[ (`"])/(@skill-names@)([^A-Za-z0-9_/-]|$)#\1/skill:\2\3#g
# One verdict vocabulary. pstack-omp and swarm both name PASS/ISSUES/BLOCKED; shipping named a
# different three, and its landing rule tested for a different set, so a verifier told by one file
# and checked by another could not satisfy both.
Expand Down Expand Up @@ -466,15 +461,6 @@ s#- Workers never rebase and never run `gt`\.#- Workers never rebase and never t
## rewritten on one side of a page and not the other, and a paraphrase of a harness rule that
## dropped half of it. Both are invisible to a diff that only looks for Cursor vocabulary.

# Bare `/<name>` is not an omp command. Skills register as `/skill:<name>`; unhandled slash input
# falls through as literal prompt text, and with `disable-model-invocation: true` the skill is
# hidden from the index, so the model cannot recover it either. The gate only greps the backticked
# form, which is why the description form survived. A per-name list here missed ketchup, sharpen,
# correct, and then ketchup-video, the same miss the alternation above records. One rule now
# covers every `Use for /<name>`.
s#Use for /([a-z][a-z0-9-]*)([ ,.])#Use for /skill:\1\2#
s#like /ketchup,#like /skill:ketchup,#

# `cursor location` is a Cursor composer affordance: the editor injects the caret position. omp is
# a terminal harness with no editor-state primitive, so an agent following the hint looks for a
# signal that does not exist.
Expand Down
52 changes: 52 additions & 0 deletions omp-port/test-gate-mutations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,53 @@ mutate_bare_skill_command() {
printf '\nRun `/how` first, then `/skill:how`.\n' >>"$FIXTURE/skills/no-comments/SKILL.md"
}

mutate_bare_skill_args() {
printf '\n- `/sharpen <your prompt>`\n' >>"$FIXTURE/skills/poteto-help/references/recipes.md"
}

mutate_bare_skill_prose() {
printf '\nType /how with a question.\n' >>"$FIXTURE/skills/poteto-help/SKILL.md"
}

mutate_not_a_skill_command() {
printf '\nSee skills/how/SKILL.md, ../how/SKILL.md, skill://how, https://example.com/how, `/how-to`, /reframed, `/poteto-mode`, and `/skill:how`.\n' \
>>"$FIXTURE/skills/poteto-help/SKILL.md"
}

make_fake_canon() {
FAKE_CANON="$WORK/fake-canon"
mkdir -p "$FAKE_CANON"
git -C "$CANON" archive "$PIN" pstack/skills pstack/agents | tar -x -C "$FAKE_CANON"
fake_git() {
git -C "$FAKE_CANON" -c init.defaultBranch=main -c user.name=gate -c user.email=gate@localhost \
-c commit.gpgsign=false -c core.hooksPath=/dev/null "$@"
}
fake_git init -q && fake_git add -A && fake_git commit -qm pin
mkdir -p "$FAKE_CANON/pstack/skills/fakenewskill"
printf -- '---\nname: fakenewskill\ndescription: A skill upstream added after this port was written. Use for /fakenewskill.\n---\n\n# Fake new skill\n' \
>"$FAKE_CANON/pstack/skills/fakenewskill/SKILL.md"
sed -i '/\[`\/tdd`\](\.\.\/tdd\/SKILL\.md)/a | Try the new thing | [`/fakenewskill`](../fakenewskill/SKILL.md) |' "$FAKE_CANON/pstack/skills/poteto-help/SKILL.md"
printf '\nType /fakenewskill with a question, or run `/fakenewskill <args>`.\n' >>"$FAKE_CANON/pstack/skills/poteto-help/SKILL.md"
fake_git add -A && fake_git commit -qm 'add fakenewskill'
FAKE_SHA=$(fake_git rev-parse HEAD)
}

mutate_new_upstream_skill() {
local build p
build=$(mktemp -d)
(CANON="$FAKE_CANON" build_tree "$FAKE_SHA" "$build") >"$build.log" 2>&1 || {
cat "$build.log"
return 1
}
rm -rf "$FIXTURE/skills" "$FIXTURE/agents"
mv "$build/skills" "$build/agents" "$FIXTURE/"
while IFS= read -r p; do
rm -rf "${FIXTURE:?}/$p"
cp -a "$PORT_DIR/../plugins/pstack/$p" "$FIXTURE/$p"
done < <(owned_paths)
rm -rf "$build" "$build.log"
}

mutate_required_item_field() {
sed -i 's/solutionSpace/spaceField/g' "$FIXTURE/skills/pstack-omp/SKILL.md"
}
Expand Down Expand Up @@ -378,6 +425,9 @@ start_case 'guide prototype playbook' 'guide claims' '' contracts mutate_guide_p
start_case 'guide feature map' 'guide claims' 'feature map' contracts mutate_guide_feature_map
start_case 'readonly after another' 'readonly posture' 'another readonly' contracts mutate_readonly_another
start_case 'bare skill command' 'skill command form' '`/how`' contracts mutate_bare_skill_command
start_case 'bare skill command with arguments' 'skill command form' '`/sharpen <your prompt>`' contracts mutate_bare_skill_args
start_case 'bare skill command in prose' 'skill command form' 'Type /how with' contracts mutate_bare_skill_prose
start_case 'paths, longer names, and poteto-mode' '' '' contracts mutate_not_a_skill_command
start_case 'required item field' 'runtime contract fields' 'solutionSpace' contracts mutate_required_item_field
# The README half only: PORTING.md lives outside the plugin root, so no fixture reaches it.
start_case 'external veto provenance' 'external capability provenance' '' contracts mutate_veto_provenance
Expand All @@ -397,6 +447,8 @@ start_case 'shipped change at a higher version' '' '' contracts mutate_shipped_b
# these cases run the whole gate and need the clone. The clone is fetched here, one sha at a time,
# before any case starts: the cases run in parallel and two fetches into one clone collide.
if ensure_canon "$PIN" "$OLD_TARGET" >/dev/null 2>&1; then
make_fake_canon
start_case 'new upstream skill linked in poteto-help' '' '' contracts mutate_new_upstream_skill
start_case 'rule matching no upstream text' 'rule staleness' 'a sentence upstream has never contained' full mutate_unmatched_rule
start_case 'delete rule matching no line' 'rule staleness' 'a line upstream has never contained' full mutate_unmatched_delete
start_case 'exemption on a live rule' 'rule staleness' 'which matches upstream text' full mutate_exemption_on_live_rule
Expand Down
8 changes: 4 additions & 4 deletions plugins/pstack/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# pstack for oh-my-pi

Lauren Tan's pstack methodology, ported to omp. 60 skills, 22 playbooks, 24 principle
leaves, the `poteto-mode` pin, and the `poteto-agent` and `comment-sicko` agents.
58 skills are built from upstream. `omp-mechanics` and `pstack-omp` are port-owned.
Lauren Tan's pstack methodology, ported to omp. The full pstack skill set with its playbooks and
principle leaves, the `poteto-mode` pin, and the `poteto-agent` and `comment-sicko` agents.
Every skill but `omp-mechanics` and `pstack-omp` is built from upstream. Those two are port-owned.

## Install

Expand All @@ -11,7 +11,7 @@ leaves, the `poteto-mode` pin, and the `poteto-agent` and `comment-sicko` agents
/marketplace install pstack@pstack-omp
```

That loads the 60 skills and both extensions, `potetomode` and `pstackpolicy`. The two agents are optional.
That loads every skill and both extensions, `potetomode` and `pstackpolicy`. The two agents are optional.
On omp 18.1.13 a marketplace plugin's `agents/` directory is scanned only through the
`claude-plugins` discovery provider, and enabling that provider also loads every Claude Code
plugin cached under `~/.claude/plugins`. Link the agents into omp's native root instead:
Expand Down
Loading