phronesis 1.0.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.
- package/README.md +66 -0
- package/package.json +34 -0
- package/src/act.js +61 -0
- package/src/active-context.js +56 -0
- package/src/adapter.js +386 -0
- package/src/cli.js +1893 -0
- package/src/codex-hooks-schema.js +92 -0
- package/src/compile.js +513 -0
- package/src/doctor.js +303 -0
- package/src/due.js +271 -0
- package/src/eval.js +467 -0
- package/src/event.js +212 -0
- package/src/export.js +136 -0
- package/src/guard.js +89 -0
- package/src/hooks.js +230 -0
- package/src/ingest.js +965 -0
- package/src/init.js +150 -0
- package/src/layout.js +394 -0
- package/src/links.js +83 -0
- package/src/lint.js +58 -0
- package/src/profile.js +116 -0
- package/src/prompts.js +26 -0
- package/src/registry.js +190 -0
- package/src/scaffold.js +134 -0
- package/src/search.js +139 -0
- package/src/skill-discovery.js +117 -0
- package/src/skills-bump.js +885 -0
- package/src/skills.js +355 -0
- package/src/subscription.js +5 -0
- package/src/validate.js +152 -0
- package/templates/claude/settings.json +86 -0
- package/templates/codex/INDEX.md +68 -0
- package/templates/codex/seed/ai-practice/compile-dont-just-capture.md +42 -0
- package/templates/codex/seed/ai-practice/design-for-the-distribution.md +42 -0
- package/templates/codex/seed/ai-practice/from-spec-author-to-outcome-curator.md +43 -0
- package/templates/codex/seed/ai-practice/recall-builds-trust-when-calibrated.md +70 -0
- package/templates/codex/seed/ai-practice/the-eval-is-the-spec.md +42 -0
- package/templates/codex/seed/ai-practice/the-gold-dust-leaves-no-trace.md +72 -0
- package/templates/codex/seed/ai-practice/the-model-is-not-the-moat.md +40 -0
- package/templates/codex/seed/ai-practice/when-generation-is-cheap-judgment-is-the-work.md +39 -0
- package/templates/codex/seed/judgment/contextual-stewardship-is-the-senior-skill.md +50 -0
- package/templates/codex/seed/judgment/decision-quality-is-distinct-from-outcome-quality.md +39 -0
- package/templates/codex/seed/judgment/embrace-reality-ego-and-blind-spots.md +38 -0
- package/templates/codex/seed/judgment/groups-seek-consensus-individuals-seek-truth.md +44 -0
- package/templates/codex/seed/judgment/heresies-are-where-the-edge-lives.md +42 -0
- package/templates/codex/seed/judgment/judgment-compounds-through-honest-reflection.md +38 -0
- package/templates/codex/seed/judgment/phronesis-is-judgment-in-the-particular.md +67 -0
- package/templates/codex/seed/judgment/show-me-the-apparatus.md +40 -0
- package/templates/codex/seed/judgment/small-judgment-gaps-compound-under-leverage.md +37 -0
- package/templates/codex/seed/judgment/taste-is-compressed-judgment.md +38 -0
- package/templates/codex/seed/judgment/trust-taste-only-where-feedback-is-valid.md +42 -0
- package/templates/codex/seed/judgment/weigh-the-reasoning-not-the-recommendation.md +43 -0
- package/templates/codex/seed/leadership/a-managers-output-is-the-teams-output.md +35 -0
- package/templates/codex/seed/leadership/most-team-problems-are-structural.md +40 -0
- package/templates/codex/seed/leadership/next-play.md +36 -0
- package/templates/codex/seed/leadership/psychological-safety.md +39 -0
- package/templates/codex/seed/leadership/right-size-your-teams.md +38 -0
- package/templates/codex/seed/leadership/spend-time-on-high-leverage-activities.md +36 -0
- package/templates/codex/seed/leadership/talent-density-is-the-master-variable.md +39 -0
- package/templates/codex/seed/leadership/under-pressure-calm-is-contagious.md +36 -0
- package/templates/codex/seed/leadership/your-best-alternative-is-your-leverage.md +37 -0
- package/templates/codex/seed/pm/a-problem-well-stated-is-half-solved.md +39 -0
- package/templates/codex/seed/pm/a-real-strategy-makes-planning-trivial.md +40 -0
- package/templates/codex/seed/pm/barrels-and-ammunition.md +39 -0
- package/templates/codex/seed/pm/develop-taste-in-your-beliefs.md +38 -0
- package/templates/codex/seed/pm/hire-for-progress.md +44 -0
- package/templates/codex/seed/pm/jobs-are-stable-solutions-churn.md +39 -0
- package/templates/codex/seed/pm/level-by-the-ambiguity-someone-can-own.md +39 -0
- package/templates/codex/seed/pm/listen-before-you-prescribe.md +38 -0
- package/templates/codex/seed/pm/live-in-the-future-and-build-whats-missing.md +38 -0
- package/templates/codex/seed/pm/match-effort-to-leverage.md +37 -0
- package/templates/codex/seed/pm/not-my-fault-but-my-problem.md +40 -0
- package/templates/codex/seed/pm/pick-the-job-then-refuse-everything-outside-it.md +37 -0
- package/templates/codex/seed/pm/retention-sets-the-ceiling.md +38 -0
- package/templates/codex/seed/pm/scale-with-leaders-not-process.md +38 -0
- package/templates/codex/seed/pm/solution-discovery-over-problem-validation.md +38 -0
- package/templates/codex/seed/pm/tenfold-better-on-a-painful-problem.md +40 -0
- package/templates/codex-surface/README.md +73 -0
- package/templates/codex-surface/hooks/_resolve.sh +36 -0
- package/templates/codex-surface/hooks/recall-guard.sh +30 -0
- package/templates/codex-surface/hooks/session-start.sh +18 -0
- package/templates/codex-surface/hooks/session-sweep-precompact.sh +20 -0
- package/templates/codex-surface/hooks/session-sweep-subagent.sh +23 -0
- package/templates/codex-surface/hooks/session-sweep.sh +19 -0
- package/templates/codex-surface/hooks.json +69 -0
- package/templates/domains/pm/AGENTS.md +111 -0
- package/templates/domains/pm/MEMORY.md +7 -0
- package/templates/domains/pm/USER.md +8 -0
- package/templates/phronesis-hooks/compile-active-context.sh +38 -0
- package/templates/phronesis-hooks/recall-guard.sh +103 -0
- package/templates/phronesis-hooks/session-start.sh +90 -0
- package/templates/phronesis-hooks/session-sweep.sh +140 -0
- package/templates/phronesis-hooks/skill-lifecycle.sh +37 -0
- package/templates/skills/compile/SKILL.md +279 -0
- package/templates/skills/compile/evals/rubric.md +75 -0
- package/templates/skills/decision-log/SKILL.md +156 -0
- package/templates/skills/decision-log/evals/rubric.md +97 -0
- package/templates/skills/extract-gold-dust/SKILL.md +311 -0
- package/templates/skills/extract-gold-dust/evals/rubric.md +52 -0
- package/templates/skills/ingest/SKILL.md +204 -0
- package/templates/skills/ingest/evals/rubric.md +117 -0
- package/templates/skills/lint/SKILL.md +246 -0
- package/templates/skills/lint/evals/rubric.md +139 -0
- package/templates/skills/meeting-prep/SKILL.md +195 -0
- package/templates/skills/meeting-prep/evals/rubric.md +93 -0
- package/templates/skills/onboard/SKILL.md +258 -0
- package/templates/skills/onboard/evals/rubric.md +60 -0
- package/templates/skills/prd-draft/SKILL.md +193 -0
- package/templates/skills/prd-draft/evals/rubric.md +38 -0
- package/templates/skills/prep-extraction/SKILL.md +217 -0
- package/templates/skills/prep-extraction/evals/rubric.md +45 -0
- package/templates/skills/recall/SKILL.md +155 -0
- package/templates/skills/recall/evals/rubric.md +37 -0
- package/templates/skills/research/SKILL.md +247 -0
- package/templates/skills/research/evals/rubric.md +139 -0
- package/templates/skills/stakeholder-update/SKILL.md +163 -0
- package/templates/skills/stakeholder-update/evals/rubric.md +111 -0
- package/vendor/core/package.json +25 -0
- package/vendor/core/src/action-registry.js +459 -0
- package/vendor/core/src/action-writers.js +201 -0
- package/vendor/core/src/actions.js +2140 -0
- package/vendor/core/src/active-context.js +167 -0
- package/vendor/core/src/artifacts.js +301 -0
- package/vendor/core/src/content-digest.js +21 -0
- package/vendor/core/src/contract.js +245 -0
- package/vendor/core/src/event-log.js +338 -0
- package/vendor/core/src/guard.js +398 -0
- package/vendor/core/src/hook-executor.js +527 -0
- package/vendor/core/src/index.js +180 -0
- package/vendor/core/src/ingest.js +286 -0
- package/vendor/core/src/install-root.js +42 -0
- package/vendor/core/src/layout.js +13 -0
- package/vendor/core/src/link-index.js +198 -0
- package/vendor/core/src/lint.js +368 -0
- package/vendor/core/src/schedule.js +535 -0
- package/vendor/core/src/search.js +534 -0
- package/vendor/core/src/session-hooks.js +129 -0
- package/vendor/core/src/skill-lifecycle.js +479 -0
- package/vendor/core/src/skill-registry.js +524 -0
- package/vendor/core/src/subscription.js +84 -0
- package/vendor/core/src/validate-object.js +62 -0
- package/vendor/core/src/workspace-scan.js +125 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: codex-principle-seed
|
|
3
|
+
name: scale-with-leaders-not-process
|
|
4
|
+
title: Scale with Leaders, Not Process
|
|
5
|
+
created: 2026-06-24
|
|
6
|
+
exposure: shareable
|
|
7
|
+
stance: adopted
|
|
8
|
+
provenance:
|
|
9
|
+
authored_by: seed
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
> **There are two ways to scale an organization — leaders or process. Process is easier, more
|
|
13
|
+
> appealing, and almost always the wrong reach.**
|
|
14
|
+
|
|
15
|
+
Heavy frameworks, elaborate governance, and layers of process promise to solve scaling with
|
|
16
|
+
structure. What they reliably deliver is a feature factory: people confusing the act of
|
|
17
|
+
managing a process with the act of creating value. The approach that actually produces good
|
|
18
|
+
outcomes is slower and harder — developing leaders who can make judgment calls, coach their
|
|
19
|
+
teams, and push decisions down to the people closest to the problem. Process feels safer than
|
|
20
|
+
trusting humans, which is exactly why organizations keep reaching for it, and exactly why it
|
|
21
|
+
keeps spreading.
|
|
22
|
+
|
|
23
|
+
This isn't a claim that process is always wrong — some work genuinely needs reliability over
|
|
24
|
+
creativity, and a checklist is the right tool for it. It's a claim about the *default reach*.
|
|
25
|
+
The instinct, when scaling strains, is to add a ritual, a gate, a sync. The better move is
|
|
26
|
+
usually to grow a leader whose judgment you can trust with the ambiguity instead.
|
|
27
|
+
|
|
28
|
+
*Diagnostic: the next time a scaling problem tempts you toward a new process, ask whether you
|
|
29
|
+
could solve it by developing a leader instead. If the honest answer is yes, the process is a
|
|
30
|
+
substitute for judgment you haven't built yet.*
|
|
31
|
+
|
|
32
|
+
*Source: Marty Cagan, citing Steve Jobs.*
|
|
33
|
+
|
|
34
|
+
## Interview Prompt
|
|
35
|
+
|
|
36
|
+
Where in your organization have you added process to paper over a scaling strain? Could that
|
|
37
|
+
same problem have been solved by developing a leader's judgment instead — and what's stopping
|
|
38
|
+
you from making that trade?
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: codex-principle-seed
|
|
3
|
+
name: solution-discovery-over-problem-validation
|
|
4
|
+
title: Solution Discovery Beats Problem Validation
|
|
5
|
+
created: 2026-06-24
|
|
6
|
+
exposure: shareable
|
|
7
|
+
stance: adopted
|
|
8
|
+
provenance:
|
|
9
|
+
authored_by: seed
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
> **The problem is usually known; the solution is where you win or lose — so spend your
|
|
13
|
+
> discovery there.**
|
|
14
|
+
|
|
15
|
+
Teams over-invest in validating problems the organization already understands — weeks of
|
|
16
|
+
interviews confirming "yes, this is a real problem" while the clock runs. But people don't buy
|
|
17
|
+
the problem; they buy a solution. Many teams can solve the same known problem; the only
|
|
18
|
+
question that matters is whether yours solves it better than the alternatives. That is
|
|
19
|
+
solution discovery — prototyping, testing, iterating toward the version that actually wins —
|
|
20
|
+
and it is consistently the underinvested half.
|
|
21
|
+
|
|
22
|
+
The discipline has a counterintuitive edge: during discovery, go looking for every reason
|
|
23
|
+
people *won't* use your solution, not for reasons they like it. A prototype test where
|
|
24
|
+
everyone nods is not discovery; it is confirmation bias with extra steps. The fastest way to
|
|
25
|
+
fool yourself is to seek validation; the fastest way to learn is to hunt for the
|
|
26
|
+
disconfirming evidence that would kill the idea, then build the version that survives it.
|
|
27
|
+
|
|
28
|
+
*Diagnostic: when you catch your team spending more time confirming a problem you already
|
|
29
|
+
understand than exploring solutions to it, you're burning runway on a known answer. And when
|
|
30
|
+
a round of research comes back all praise, ask what you would have had to do to surface the
|
|
31
|
+
reasons people would walk away.*
|
|
32
|
+
|
|
33
|
+
*Source: Marty Cagan.*
|
|
34
|
+
|
|
35
|
+
## Interview Prompt
|
|
36
|
+
|
|
37
|
+
When you test an idea, are you looking for reasons it will work or reasons it won't? Describe
|
|
38
|
+
the last time you went hunting for the evidence that would kill one of your own ideas.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: codex-principle-seed
|
|
3
|
+
name: tenfold-better-on-a-painful-problem
|
|
4
|
+
title: Tenfold Better on a Painful Problem
|
|
5
|
+
created: 2026-06-24
|
|
6
|
+
exposure: shareable
|
|
7
|
+
stance: adopted
|
|
8
|
+
provenance:
|
|
9
|
+
authored_by: seed
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
> **A new offering must be a large multiple better on a problem that genuinely hurts — not a
|
|
13
|
+
> marginal improvement on one people tolerate.**
|
|
14
|
+
|
|
15
|
+
Weigh the value you deliver against the pain a customer goes through to adopt you — finding
|
|
16
|
+
you, trying you, buying you, switching away from whatever they use now, and the ever-present
|
|
17
|
+
option to just do nothing. Because betting on something new carries real risk for the buyer, a
|
|
18
|
+
small edge doesn't clear the bar. As a rule of thumb the gain has to be roughly an order of
|
|
19
|
+
magnitude — tenfold — before the math tips in your favor. Founders who fail in market are
|
|
20
|
+
rarely wrong about the gain; they're wrong about the adoption pain they never honestly
|
|
21
|
+
measured.
|
|
22
|
+
|
|
23
|
+
This is why "faster, cheaper, better" is not a real position — those describe an increment the
|
|
24
|
+
incumbent can close, not a breakthrough. And the multiple only matters if the underlying
|
|
25
|
+
problem is a painkiller, not a vitamin: a blatant, critical need the customer already feels
|
|
26
|
+
and will pay to make stop, not an aspirational nice-to-have they can postpone forever. Solve a
|
|
27
|
+
tolerated problem a little better and the customer's honest answer is "interesting" — and then
|
|
28
|
+
they do nothing.
|
|
29
|
+
|
|
30
|
+
*Diagnostic: describe your edge in one sentence. If the best you can say is "faster, cheaper,
|
|
31
|
+
better," you have an improvement, not a breakthrough — and you've probably underpriced what
|
|
32
|
+
adoption really costs. Then ask whether the problem is one people actively try to make stop,
|
|
33
|
+
or one they merely tolerate.*
|
|
34
|
+
|
|
35
|
+
*Source: Michael Skok.*
|
|
36
|
+
|
|
37
|
+
## Interview Prompt
|
|
38
|
+
|
|
39
|
+
For the thing you're building, how much better is it than the real alternative — and is the
|
|
40
|
+
problem it solves something people actively hurt from, or just mildly wish were better?
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Phronesis Codex Surface Adapter
|
|
2
|
+
|
|
3
|
+
This directory is emitted as `domains/<slug>/.codex/` by `phronesis init`.
|
|
4
|
+
It is the Codex Tier 1 surface adapter from change 0028 / core-0034, wired
|
|
5
|
+
against `specs/hooks.md` "Surface adapters".
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Codex native lifecycle hooks run the same Phronesis reinforcement scripts as
|
|
10
|
+
Claude Code. The JSON config points each Codex event at a small launcher in
|
|
11
|
+
`./hooks/`; each launcher resolves the installation root and hands off to the
|
|
12
|
+
shared script under `<install>/.phronesis/hooks/`.
|
|
13
|
+
|
|
14
|
+
Keep `hooks.json` schema-pure. Codex parses hook config strictly: unknown JSON
|
|
15
|
+
fields are fatal at every level, and there is no JSON comment mechanism.
|
|
16
|
+
Documentation belongs in this README or in script comments, never in
|
|
17
|
+
`hooks.json`.
|
|
18
|
+
|
|
19
|
+
## Root Resolution
|
|
20
|
+
|
|
21
|
+
Codex has no `$CLAUDE_PROJECT_DIR` equivalent and runs hooks at the session
|
|
22
|
+
working directory. Each launcher marks `PHRONESIS_SURFACE=codex`, resolves the
|
|
23
|
+
installation root with `hooks/_resolve.sh`, then execs the matching shared
|
|
24
|
+
script in `<install>/.phronesis/hooks/`.
|
|
25
|
+
|
|
26
|
+
The resolver anchors on the launcher location first, then falls back to walking
|
|
27
|
+
up to the nearest `.phronesis/` marker. That keeps the launcher tied to its own
|
|
28
|
+
install even when the session cwd is a subdirectory or another install is nearby.
|
|
29
|
+
|
|
30
|
+
## Open Target
|
|
31
|
+
|
|
32
|
+
Open Codex at the domain workspace directory:
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
<install>/domains/<slug>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Codex loads `.codex/` only from the opened directory. It does not walk up to a
|
|
39
|
+
parent root, even when the parent is a git root. The 2026-06-21 spike confirmed
|
|
40
|
+
that opening the install root leaves these hooks unloaded.
|
|
41
|
+
|
|
42
|
+
## Trust Gates
|
|
43
|
+
|
|
44
|
+
Codex has two trust gates:
|
|
45
|
+
|
|
46
|
+
1. Trust the project `.codex/` layer.
|
|
47
|
+
2. Enable each hook hash through CLI `/hooks` or the desktop app's
|
|
48
|
+
Settings -> Coding -> Hooks pane.
|
|
49
|
+
|
|
50
|
+
Editing `hooks.json` or a launcher changes the hook hash and requires a new
|
|
51
|
+
trust pass. A no-op `phronesis init` should re-emit byte-identical files, so it
|
|
52
|
+
does not force a re-trust.
|
|
53
|
+
|
|
54
|
+
## Wiring
|
|
55
|
+
|
|
56
|
+
| Codex event | Launcher | Shared script | Output role |
|
|
57
|
+
|---|---|---|---|
|
|
58
|
+
| `SessionStart` | `.codex/hooks/session-start.sh` | `.phronesis/hooks/session-start.sh` | Due-check `additionalContext` |
|
|
59
|
+
| `UserPromptSubmit` | `.codex/hooks/recall-guard.sh` | `.phronesis/hooks/recall-guard.sh` | Recall guard `additionalContext` |
|
|
60
|
+
| `Stop` | `.codex/hooks/session-sweep.sh` | `.phronesis/hooks/session-sweep.sh` | Capture sweep `decision:block` plus `reason` |
|
|
61
|
+
| `SubagentStop` | `.codex/hooks/session-sweep-subagent.sh` | `.phronesis/hooks/session-sweep.sh` | Subagent sweep variant |
|
|
62
|
+
| `PreCompact` | `.codex/hooks/session-sweep-precompact.sh` | `.phronesis/hooks/session-sweep.sh` | Compaction reminder |
|
|
63
|
+
|
|
64
|
+
The commands in `hooks.json` are bare relative paths with no arguments. The
|
|
65
|
+
variant is baked into each launcher, so the wiring works whether Codex execs the
|
|
66
|
+
command directly or through a shell.
|
|
67
|
+
|
|
68
|
+
## Runtime-Free Degrade
|
|
69
|
+
|
|
70
|
+
Every launcher exits cleanly with no output when no `phronesis` runtime is on
|
|
71
|
+
`PATH` or when its target shared script is missing. That runtime-free no-op
|
|
72
|
+
posture is part of change 0013: missing runtime means an honest gap, not a
|
|
73
|
+
noisy hook failure.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Phronesis Codex launcher resolver — SOURCED by the .codex/hooks/*.sh launchers (change
|
|
3
|
+
# 0028 / core-0034). Sets PHRONESIS_ROOT to the installation root, or `exit 0` (a clean
|
|
4
|
+
# runtime-free / no-install degrade that the sourcing launcher inherits).
|
|
5
|
+
#
|
|
6
|
+
# Resolution anchors on THIS file's own emitted location — it ships at
|
|
7
|
+
# <root>/domains/{slug}/.codex/hooks/_resolve.sh, a fixed FOUR levels under the install
|
|
8
|
+
# root — so it is independent of the session cwd AND immune to a stray .phronesis/ ancestor
|
|
9
|
+
# (a second checkout, or a domain workspace copied out of its install). A blind
|
|
10
|
+
# walk-up-from-cwd would capture the wrong install in those cases. Only if that fixed anchor
|
|
11
|
+
# does not resolve to an install (e.g. the open target was relocated to a different depth)
|
|
12
|
+
# does it fall back to a nearest-.phronesis walk-up from cwd. The launcher still verifies the
|
|
13
|
+
# target script before exec, so an incomplete install degrades to a clean no-op, never a
|
|
14
|
+
# noisy `env: … No such file` (exit 127).
|
|
15
|
+
command -v phronesis >/dev/null 2>&1 || exit 0
|
|
16
|
+
|
|
17
|
+
# Bare ${BASH_SOURCE:-$0}, NOT the array-subscript "[0]" form: that subscript is a bashism that
|
|
18
|
+
# dash (the `sh <path>` interpreter on Linux/CI) rejects with "Bad substitution", and this file
|
|
19
|
+
# is SOURCED by a launcher that may itself be running under dash (core-0034 review #1, round 3).
|
|
20
|
+
# Under bash, bare $BASH_SOURCE is array element 0 = THIS file's path (sourced-frame aware).
|
|
21
|
+
# Under POSIX sh it is unset → $0, which in a sourced frame is the *launcher's* $0 — but the
|
|
22
|
+
# launcher is co-located with this resolver in the same .codex/hooks/ dir, so `dirname` lands on
|
|
23
|
+
# that dir either way, and the four-levels-up anchor below is identical.
|
|
24
|
+
__src="${BASH_SOURCE:-$0}"
|
|
25
|
+
__here="$(cd "$(dirname "$__src")" 2>/dev/null && pwd || true)"
|
|
26
|
+
PHRONESIS_ROOT=""
|
|
27
|
+
if [ -n "$__here" ]; then
|
|
28
|
+
__anchor="$(cd "$__here/../../../.." 2>/dev/null && pwd || true)"
|
|
29
|
+
if [ -n "$__anchor" ] && [ -d "$__anchor/.phronesis" ]; then PHRONESIS_ROOT="$__anchor"; fi
|
|
30
|
+
fi
|
|
31
|
+
if [ -z "$PHRONESIS_ROOT" ]; then
|
|
32
|
+
__d="$PWD"
|
|
33
|
+
while [ "$__d" != "/" ] && [ ! -d "$__d/.phronesis" ]; do __d="$(dirname "$__d")"; done
|
|
34
|
+
[ -d "$__d/.phronesis" ] && PHRONESIS_ROOT="$__d"
|
|
35
|
+
fi
|
|
36
|
+
[ -n "$PHRONESIS_ROOT" ] || exit 0
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Phronesis Codex surface launcher → recall-guard (UserPromptSubmit).
|
|
3
|
+
#
|
|
4
|
+
# Resolves the install root via the sibling _resolve.sh (sourced — it anchors on the
|
|
5
|
+
# launcher's own emitted location, so it is cwd-independent and decoy-immune), then hands
|
|
6
|
+
# the event off on stdin to the SHARED, surface-aware recall-guard.sh in
|
|
7
|
+
# <install>/.phronesis/hooks/, marking PHRONESIS_SURFACE=codex. The .codex/hooks.json wires
|
|
8
|
+
# this as a BARE no-arg command path (the variant flag, if any, is baked into the launcher),
|
|
9
|
+
# so the wiring holds whether Codex execs directly or via a shell — one script set, branch
|
|
10
|
+
# on surface (specs/hooks.md §"Surface adapters").
|
|
11
|
+
#
|
|
12
|
+
# Runtime-free / no-install / incomplete-install degrade (change 0013): exit 0, no output —
|
|
13
|
+
# an honest gap, never a noisy error. _resolve.sh exits 0 when phronesis is off PATH or no
|
|
14
|
+
# install resolves; the target-exists check below covers an incomplete install.
|
|
15
|
+
# `set -u` only (no pipefail): no pipelines here, and `set -o pipefail` aborts noisily under
|
|
16
|
+
# a strict POSIX /bin/sh if Codex execs the bare command via `sh <path>` (core-0034 review
|
|
17
|
+
# #2). The exec'd shared script keeps its own bash shebang + pipefail.
|
|
18
|
+
#
|
|
19
|
+
# The source line below uses bare ${BASH_SOURCE:-$0} — NOT the array-subscript "[0]" form: that
|
|
20
|
+
# subscript is a bashism that dash (the `sh <path>` interpreter on Linux/CI) rejects with "Bad
|
|
21
|
+
# substitution" and exits 2 — BEFORE any degrade path — which would defeat the very POSIX-safety
|
|
22
|
+
# the pipefail choice above buys (core-0034 review #1, round 3). Bare $BASH_SOURCE reads array
|
|
23
|
+
# element 0 under bash and is an unset (→ $0) plain var under POSIX sh; both name THIS launcher,
|
|
24
|
+
# and the launcher is co-located with _resolve.sh, so `dirname` lands on the hooks dir either way.
|
|
25
|
+
set -u
|
|
26
|
+
|
|
27
|
+
. "$(cd "$(dirname "${BASH_SOURCE:-$0}")" 2>/dev/null && pwd || echo /nonexistent)/_resolve.sh" 2>/dev/null || exit 0
|
|
28
|
+
target="$PHRONESIS_ROOT/.phronesis/hooks/recall-guard.sh"
|
|
29
|
+
[ -x "$target" ] || exit 0
|
|
30
|
+
exec env PHRONESIS_SURFACE=codex PHRONESIS_DIR="$PHRONESIS_ROOT" "$target" "$@"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Phronesis Codex surface launcher → session-start due-check (SessionStart).
|
|
3
|
+
#
|
|
4
|
+
# Resolves the install root via the sibling _resolve.sh (sourced) and hands off to the
|
|
5
|
+
# SHARED session-start.sh, which under PHRONESIS_SURFACE=codex wraps the due-check printout
|
|
6
|
+
# in Codex's hookSpecificOutput.additionalContext shape. See recall-guard.sh for the
|
|
7
|
+
# launcher rationale; see _resolve.sh for the cwd-independent, decoy-immune root resolution.
|
|
8
|
+
#
|
|
9
|
+
# Runtime-free / no-install / incomplete-install degrade (change 0013): exit 0, no output.
|
|
10
|
+
# `set -u` only (no pipefail), and bare ${BASH_SOURCE:-$0} not the "[0]"-subscript form — both
|
|
11
|
+
# keep this POSIX /bin/sh-safe (dash rejects the array subscript with "Bad substitution"); see
|
|
12
|
+
# recall-guard.sh (core-0034 #2 / #1-round-3).
|
|
13
|
+
set -u
|
|
14
|
+
|
|
15
|
+
. "$(cd "$(dirname "${BASH_SOURCE:-$0}")" 2>/dev/null && pwd || echo /nonexistent)/_resolve.sh" 2>/dev/null || exit 0
|
|
16
|
+
target="$PHRONESIS_ROOT/.phronesis/hooks/session-start.sh"
|
|
17
|
+
[ -x "$target" ] || exit 0
|
|
18
|
+
exec env PHRONESIS_SURFACE=codex PHRONESIS_DIR="$PHRONESIS_ROOT" "$target" "$@"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Phronesis Codex surface launcher → pre-compaction capture reminder (PreCompact).
|
|
3
|
+
#
|
|
4
|
+
# The --advisory variant of the shared session-sweep.sh: it cannot block, so it surfaces a
|
|
5
|
+
# best-effort "review the conversation for unstored context before it compacts" reminder.
|
|
6
|
+
# Under PHRONESIS_SURFACE=codex the shared script emits the reminder as Codex's
|
|
7
|
+
# {"systemMessage":...} (Claude Code takes the raw line). The variant flag is baked in here,
|
|
8
|
+
# not passed through hooks.json, so the command path stays bare. See recall-guard.sh /
|
|
9
|
+
# _resolve.sh for the launcher mechanics.
|
|
10
|
+
#
|
|
11
|
+
# Runtime-free / no-install / incomplete-install degrade (change 0013): exit 0, no output.
|
|
12
|
+
# `set -u` only (no pipefail), and bare ${BASH_SOURCE:-$0} not the "[0]"-subscript form — both
|
|
13
|
+
# keep this POSIX /bin/sh-safe (dash rejects the array subscript with "Bad substitution"); see
|
|
14
|
+
# recall-guard.sh (core-0034 #2 / #1-round-3).
|
|
15
|
+
set -u
|
|
16
|
+
|
|
17
|
+
. "$(cd "$(dirname "${BASH_SOURCE:-$0}")" 2>/dev/null && pwd || echo /nonexistent)/_resolve.sh" 2>/dev/null || exit 0
|
|
18
|
+
target="$PHRONESIS_ROOT/.phronesis/hooks/session-sweep.sh"
|
|
19
|
+
[ -x "$target" ] || exit 0
|
|
20
|
+
exec env PHRONESIS_SURFACE=codex PHRONESIS_DIR="$PHRONESIS_ROOT" "$target" --advisory "$@"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Phronesis Codex surface launcher → subagent-boundary sweep (SubagentStop).
|
|
3
|
+
#
|
|
4
|
+
# The --lifecycle-only variant of the shared session-sweep.sh: it skips the capture sweep
|
|
5
|
+
# and only closes an open skill-lifecycle record for the subagent boundary. On Codex this is
|
|
6
|
+
# presently inert — Codex mints no invocation_id (no UserPromptExpansion / matchable Skill
|
|
7
|
+
# PreToolUse, so skill-lifecycle telemetry is Level-2 PARTIAL, change 0028 /
|
|
8
|
+
# event-log.md §"Compliance levels") — so there is nothing to close. It is wired with the
|
|
9
|
+
# SAME script Claude Code uses (not a Codex-specific path) so the boundary is handled
|
|
10
|
+
# correctly if Codex later surfaces the lifecycle; it fabricates nothing meanwhile (emission
|
|
11
|
+
# honesty, change 0021). The variant flag is baked in here, not passed through hooks.json, so
|
|
12
|
+
# the command path stays bare. See recall-guard.sh / _resolve.sh for the launcher mechanics.
|
|
13
|
+
#
|
|
14
|
+
# Runtime-free / no-install / incomplete-install degrade (change 0013): exit 0, no output.
|
|
15
|
+
# `set -u` only (no pipefail), and bare ${BASH_SOURCE:-$0} not the "[0]"-subscript form — both
|
|
16
|
+
# keep this POSIX /bin/sh-safe (dash rejects the array subscript with "Bad substitution"); see
|
|
17
|
+
# recall-guard.sh (core-0034 #2 / #1-round-3).
|
|
18
|
+
set -u
|
|
19
|
+
|
|
20
|
+
. "$(cd "$(dirname "${BASH_SOURCE:-$0}")" 2>/dev/null && pwd || echo /nonexistent)/_resolve.sh" 2>/dev/null || exit 0
|
|
21
|
+
target="$PHRONESIS_ROOT/.phronesis/hooks/session-sweep.sh"
|
|
22
|
+
[ -x "$target" ] || exit 0
|
|
23
|
+
exec env PHRONESIS_SURFACE=codex PHRONESIS_DIR="$PHRONESIS_ROOT" "$target" --lifecycle-only "$@"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Phronesis Codex surface launcher → capture sweep (Stop).
|
|
3
|
+
#
|
|
4
|
+
# Resolves the install root via the sibling _resolve.sh (sourced) and hands the Stop event
|
|
5
|
+
# off on stdin to the SHARED session-sweep.sh. The block-continue output
|
|
6
|
+
# ({"decision":"block","reason":...}) and the stop_hook_active loop guard are identical
|
|
7
|
+
# across Claude Code and Codex (spike 2026-06-21), so the shared script needs no Stop-path
|
|
8
|
+
# branch. See recall-guard.sh for the launcher rationale; _resolve.sh for root resolution.
|
|
9
|
+
#
|
|
10
|
+
# Runtime-free / no-install / incomplete-install degrade (change 0013): exit 0, no output.
|
|
11
|
+
# `set -u` only (no pipefail), and bare ${BASH_SOURCE:-$0} not the "[0]"-subscript form — both
|
|
12
|
+
# keep this POSIX /bin/sh-safe (dash rejects the array subscript with "Bad substitution"); see
|
|
13
|
+
# recall-guard.sh (core-0034 #2 / #1-round-3).
|
|
14
|
+
set -u
|
|
15
|
+
|
|
16
|
+
. "$(cd "$(dirname "${BASH_SOURCE:-$0}")" 2>/dev/null && pwd || echo /nonexistent)/_resolve.sh" 2>/dev/null || exit 0
|
|
17
|
+
target="$PHRONESIS_ROOT/.phronesis/hooks/session-sweep.sh"
|
|
18
|
+
[ -x "$target" ] || exit 0
|
|
19
|
+
exec env PHRONESIS_SURFACE=codex PHRONESIS_DIR="$PHRONESIS_ROOT" "$target" "$@"
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"SessionStart": [
|
|
4
|
+
{
|
|
5
|
+
"matcher": "startup|resume",
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": ".codex/hooks/session-start.sh",
|
|
10
|
+
"timeout": 30,
|
|
11
|
+
"statusMessage": "phronesis due-check"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"UserPromptSubmit": [
|
|
17
|
+
{
|
|
18
|
+
"matcher": "",
|
|
19
|
+
"hooks": [
|
|
20
|
+
{
|
|
21
|
+
"type": "command",
|
|
22
|
+
"command": ".codex/hooks/recall-guard.sh",
|
|
23
|
+
"timeout": 30,
|
|
24
|
+
"statusMessage": "phronesis recall guard"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"Stop": [
|
|
30
|
+
{
|
|
31
|
+
"matcher": "",
|
|
32
|
+
"hooks": [
|
|
33
|
+
{
|
|
34
|
+
"type": "command",
|
|
35
|
+
"command": ".codex/hooks/session-sweep.sh",
|
|
36
|
+
"timeout": 30,
|
|
37
|
+
"statusMessage": "phronesis capture sweep"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"SubagentStop": [
|
|
43
|
+
{
|
|
44
|
+
"matcher": "",
|
|
45
|
+
"hooks": [
|
|
46
|
+
{
|
|
47
|
+
"type": "command",
|
|
48
|
+
"command": ".codex/hooks/session-sweep-subagent.sh",
|
|
49
|
+
"timeout": 30,
|
|
50
|
+
"statusMessage": "phronesis subagent sweep"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
"PreCompact": [
|
|
56
|
+
{
|
|
57
|
+
"matcher": "",
|
|
58
|
+
"hooks": [
|
|
59
|
+
{
|
|
60
|
+
"type": "command",
|
|
61
|
+
"command": ".codex/hooks/session-sweep-precompact.sh",
|
|
62
|
+
"timeout": 30,
|
|
63
|
+
"statusMessage": "phronesis compaction reminder"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# AGENTS.md — Phronesis PM door
|
|
2
|
+
|
|
3
|
+
Canonical session spec for this domain workspace; `CLAUDE.md` and `.cursorrules`
|
|
4
|
+
symlink to it. Keep it ≤8KB: pointers, not current state. If a rule keeps
|
|
5
|
+
getting missed, prune this file or move the rule to a hook.
|
|
6
|
+
|
|
7
|
+
**What Phronesis is.** One product: a phronesis-grounded Markdown workspace on
|
|
8
|
+
the operator's disk. Per domain: `raw/` source + `compiled/` durable state.
|
|
9
|
+
Shared across the install: `codex/`. Read the tiny always-loaded set, then pull
|
|
10
|
+
on demand. This is the PM door. Language: "one product", "doors" /
|
|
11
|
+
"configurations". Never "umbrella", "vertical", or "platform".
|
|
12
|
+
|
|
13
|
+
## 1. Operator
|
|
14
|
+
|
|
15
|
+
[Name], [Role]. Full profile and working preferences: `USER.md` (always read).
|
|
16
|
+
|
|
17
|
+
## 2. Operating style
|
|
18
|
+
|
|
19
|
+
- Bring everything the operator has met to bear on what's in front of them. That is the work.
|
|
20
|
+
- Say only what the moment needs. Brevity is judgment, not speed.
|
|
21
|
+
- The operator has told you this before. Find it before you make them say it twice.
|
|
22
|
+
- If you have not read it, you do not know it. Cite what you read; assert no workspace claim you have not read.
|
|
23
|
+
- When the workspace is silent on something it should hold, say so. An honest "nothing yet" beats a confident guess.
|
|
24
|
+
- Catch what matters as it goes by. Don't halt the work to file it.
|
|
25
|
+
- A framework can frame the call. It cannot make it. Read the situation, then decide.
|
|
26
|
+
- Make the call from evidence. "No — and here's why" helps more than hedging.
|
|
27
|
+
- Reach for what this turn needs, no more. The rest keeps.
|
|
28
|
+
|
|
29
|
+
## 3. Session start
|
|
30
|
+
|
|
31
|
+
1. **Always read:** this file, `USER.md`, `MEMORY.md`.
|
|
32
|
+
2. **Read if present:** `memory/long-term.md`, today's `memory/YYYY-MM-DD.md`, the installation `codex/INDEX.md`, and the seed/personal codex articles the task calls for.
|
|
33
|
+
3. **List, do not preload:** the generated domain index (if present), `compiled/people/` (door: stakeholders), `compiled/projects/`, `compiled/decisions/`.
|
|
34
|
+
4. **Do not preload:** every stakeholder file, every decision file, the whole codex, or all skills. Pull each on trigger.
|
|
35
|
+
|
|
36
|
+
## 4. Skills
|
|
37
|
+
|
|
38
|
+
<!-- skills:begin -->
|
|
39
|
+
| Skill | Directory | Triggers |
|
|
40
|
+
|---|---|---|
|
|
41
|
+
| _generated at init_ | | |
|
|
42
|
+
<!-- skills:end -->
|
|
43
|
+
|
|
44
|
+
## 5. Ambient behaviors
|
|
45
|
+
|
|
46
|
+
These fire on cue, not on command. They are the felt presence.
|
|
47
|
+
|
|
48
|
+
**Recall before advice.** On owned-context/advice prompts or known names/projects/decisions/commitments, search active-domain `compiled/` plus `codex/`, walk links, and lead with workspace truth. If nothing relevant exists, say so, answer generally, and consider capture. Never answer owned-context while the workspace sits unread.
|
|
49
|
+
|
|
50
|
+
**Capture decisions.** When the operator settles a choice with a reason, catch it for `log_decision`. Do not make them stop and file.
|
|
51
|
+
|
|
52
|
+
**Capture stakeholders.** When a person arrives with a preference, constraint, or relationship worth keeping, note a short quote plus source. New name: propose a `person` in `compiled/people/` via `enrich_person`; known name: enrich the existing one.
|
|
53
|
+
|
|
54
|
+
**Surface the conflict.** When a forming decision rhymes with compiled history, pause with the prior decision or insight before commitment — only when the rhyme is real and stakes are live.
|
|
55
|
+
|
|
56
|
+
**Catch incoming raw.** New material lands in `raw/`. Ingest, then compile through the gate into `compiled/`; untrusted sources stay draft until approval. Cross-linking one source across artifacts is the value.
|
|
57
|
+
|
|
58
|
+
**Know when to hold.** Not every fact is worth catching, nor every echo worth raising. Do not count motion as progress; "ingested four threads, started eight loops" is noise.
|
|
59
|
+
|
|
60
|
+
## 6. Mesh principle
|
|
61
|
+
|
|
62
|
+
Every output feeds the next input. A session that touched real work leaves something true
|
|
63
|
+
behind: a decision caught, a stakeholder understood a little better, a link that wasn't
|
|
64
|
+
there before. Not a tally of edits — one true thing the next session can build on beats ten
|
|
65
|
+
that only move state around. The workspace compounds on what's real, or it bloats on what
|
|
66
|
+
isn't.
|
|
67
|
+
|
|
68
|
+
## 7. File map
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
phronesis-installation/
|
|
72
|
+
├── codex/ Layer 3 · installation-shared, citable from every domain
|
|
73
|
+
│ ├── INDEX.md on-demand codex map
|
|
74
|
+
│ ├── seed/ immutable seeded principles
|
|
75
|
+
│ └── personal/ operator-earned and adopted principles
|
|
76
|
+
├── skills/ installed engine + door skills
|
|
77
|
+
├── .phronesis/ runtime · hooks/ events/ evals/ connectors/ registry.json
|
|
78
|
+
└── domains/
|
|
79
|
+
└── pm/ this door — you are here
|
|
80
|
+
├── AGENTS.md this file · CLAUDE.md and .cursorrules symlink to it
|
|
81
|
+
├── USER.md operator profile · always read
|
|
82
|
+
├── MEMORY.md compound-memory index · always read
|
|
83
|
+
├── raw/ Layer 1 · append-only source
|
|
84
|
+
│ ├── transcripts/ threads/ inbox/ meetings/
|
|
85
|
+
│ ├── research/ output of the research skill
|
|
86
|
+
│ └── {connector}/ one dir per active connector
|
|
87
|
+
├── compiled/ Layer 2 · durable current state
|
|
88
|
+
│ ├── people/ projects/ decisions/
|
|
89
|
+
│ └── commitments/ insights/ organizations/
|
|
90
|
+
├── memory/ session-scoped working notes
|
|
91
|
+
│ └── YYYY-MM-DD.md · long-term.md
|
|
92
|
+
└── exports/ disposable renders
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## 8. Where state lives
|
|
96
|
+
|
|
97
|
+
Pointers only; read sources for current truth.
|
|
98
|
+
|
|
99
|
+
- Operator profile/preferences -> `USER.md`.
|
|
100
|
+
- Memory index -> `MEMORY.md`; details live behind links.
|
|
101
|
+
- People/organizations/projects/decisions/commitments/insights -> `compiled/{type-dir}/`. Door terms "stakeholder" and "competitor" are relationships on `person`/`organization`, never `type:`.
|
|
102
|
+
- Claim sources -> `raw/`, cited from compiled objects.
|
|
103
|
+
- Shared principles -> install `codex/` (`seed/` immutable, `personal/` earned); map: `codex/INDEX.md`.
|
|
104
|
+
- Session notes -> `memory/YYYY-MM-DD.md`; durable notes -> `memory/long-term.md`.
|
|
105
|
+
- Skill set/versions -> `.phronesis/registry.json`; triggers/bodies -> `skills/{name}/SKILL.md`; §4 projects both.
|
|
106
|
+
- Hooks/events/connectors/config -> `.phronesis/`.
|
|
107
|
+
- Disposable renders -> `exports/`; never source of truth, never round-trip edits through it.
|
|
108
|
+
|
|
109
|
+
Do not summarize current state here. No active project, no default, no "this arena is
|
|
110
|
+
empty". Stale always-loaded prose convinces the agent not to retrieve: the one failure
|
|
111
|
+
this file exists to prevent.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# MEMORY — PM door
|
|
2
|
+
|
|
3
|
+
Always-loaded compound-memory index. One line per remembered fact.
|
|
4
|
+
Format: `- [Title](file.md) — one-line hook`. Detail lives in the linked file;
|
|
5
|
+
this index is the always-loaded surface. Keep it ≤5KB — prune before it grows.
|
|
6
|
+
|
|
7
|
+
<!-- Compound-memory writes append entries below, grouped by type slug. -->
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# USER — [Name]
|
|
2
|
+
|
|
3
|
+
- Name: [Name]
|
|
4
|
+
- Role: [Role]
|
|
5
|
+
|
|
6
|
+
Operator profile. Minimal at init; onboarding (deferred) captures preferences,
|
|
7
|
+
product context, and working style. Until then, ask before assuming — do not
|
|
8
|
+
infer the operator's preferences from a blank profile.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Phronesis post-compile hook (core-0017 H5): refresh a domain's active-context projection
|
|
3
|
+
# (domains/{domain}/ACTIVE_CONTEXT.md) after a compile commits canonical state. Subscribes
|
|
4
|
+
# to action_type.committed filtered to payload.action_type == compile; the V1 in-pipeline
|
|
5
|
+
# executor fires it synchronously at the commit point (compile accept fires it too, since
|
|
6
|
+
# acceptance emits the same committed event). The committed event arrives as JSON on stdin.
|
|
7
|
+
#
|
|
8
|
+
# It is a MUTATION hook (it writes the tracked projection) — a failure is audited but never
|
|
9
|
+
# blocks the commit. Generated state is never a free-form action write (core-0016 review
|
|
10
|
+
# finding #2), so the refresh runs through the deterministic generator, not a hand-edit.
|
|
11
|
+
#
|
|
12
|
+
# Runtime-free degrade (change 0013): with no phronesis on PATH this exits 0 silently — a
|
|
13
|
+
# compile without the runtime simply leaves the projection for the next runtime pass; the
|
|
14
|
+
# validate-time staleness check is the backstop that flags it stale meanwhile.
|
|
15
|
+
set -uo pipefail
|
|
16
|
+
|
|
17
|
+
command -v phronesis >/dev/null 2>&1 || exit 0
|
|
18
|
+
|
|
19
|
+
input="$(cat || true)"
|
|
20
|
+
# The committed payload.path is domains/{domain}/compiled/{type-dir}/{name}.md; the domain
|
|
21
|
+
# is its second segment. node is present wherever phronesis is (the CLI runs on it), so
|
|
22
|
+
# parse the JSON properly instead of regexing it.
|
|
23
|
+
domain="$(printf '%s' "$input" | node -e '
|
|
24
|
+
let d = "";
|
|
25
|
+
process.stdin.on("data", (c) => (d += c)).on("end", () => {
|
|
26
|
+
try {
|
|
27
|
+
const ev = JSON.parse(d);
|
|
28
|
+
const p = String((ev && ev.payload && ev.payload.path) || "");
|
|
29
|
+
const parts = p.split("/");
|
|
30
|
+
process.stdout.write(parts[0] === "domains" && parts[1] ? parts[1] : "");
|
|
31
|
+
} catch {}
|
|
32
|
+
});' 2>/dev/null)"
|
|
33
|
+
[ -n "$domain" ] || exit 0
|
|
34
|
+
|
|
35
|
+
# cwd is the install root (the executor sets it); --dir makes discovery explicit.
|
|
36
|
+
phronesis active-context refresh --domain "$domain" --dir "$PWD" >/dev/null || true
|
|
37
|
+
|
|
38
|
+
exit 0
|