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,117 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import fse from 'fs-extra';
|
|
4
|
+
import { loadSkills, resolveActionTypes } from '@phronesis/core';
|
|
5
|
+
|
|
6
|
+
export const SKILL_DISCOVERY_BEGIN = '<!-- skills:begin -->';
|
|
7
|
+
export const SKILL_DISCOVERY_END = '<!-- skills:end -->';
|
|
8
|
+
|
|
9
|
+
function cell(value) {
|
|
10
|
+
return String(value).replace(/\|/g, '\\|').replace(/\s+/g, ' ').trim();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function triggerSummary(invocation) {
|
|
14
|
+
if (invocation.explicit.length) {
|
|
15
|
+
return [invocation.explicit[0], invocation.suggested[0]].filter(Boolean);
|
|
16
|
+
}
|
|
17
|
+
if (invocation.suggested.length) return invocation.suggested.slice(0, 2);
|
|
18
|
+
if (invocation.woven) return ['(woven)'];
|
|
19
|
+
return ['(no trigger)'];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function buildSkillDiscoveryBlock(skills) {
|
|
23
|
+
const rows = [
|
|
24
|
+
SKILL_DISCOVERY_BEGIN,
|
|
25
|
+
'| Skill | Directory | Triggers |',
|
|
26
|
+
'|---|---|---|',
|
|
27
|
+
];
|
|
28
|
+
for (const [name, skill] of Object.entries(skills)) {
|
|
29
|
+
const triggers = triggerSummary(skill.invocation).map((t) => `\`${cell(t)}\``).join(', ');
|
|
30
|
+
rows.push(`| \`${cell(name)}\` | \`skills/${cell(name)}/\` | ${triggers} |`);
|
|
31
|
+
}
|
|
32
|
+
rows.push(
|
|
33
|
+
'Read a skill\'s `SKILL.md` only when its trigger fires; never preload all skills.',
|
|
34
|
+
'Raw-stage skills (`ingest`, `research`) feed `compile`.',
|
|
35
|
+
SKILL_DISCOVERY_END,
|
|
36
|
+
);
|
|
37
|
+
return rows.join('\n');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function replaceSkillDiscoveryBlock(agents, block) {
|
|
41
|
+
const start = agents.indexOf(SKILL_DISCOVERY_BEGIN);
|
|
42
|
+
const end = agents.indexOf(SKILL_DISCOVERY_END);
|
|
43
|
+
if (start === -1 || end === -1 || end < start) {
|
|
44
|
+
throw new Error('AGENTS.md section 4 is missing the skills:begin/end markers');
|
|
45
|
+
}
|
|
46
|
+
return `${agents.slice(0, start)}${block}${agents.slice(end + SKILL_DISCOVERY_END.length)}`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export async function buildSkillDiscoveryForRegistry({ installRoot, registry }) {
|
|
50
|
+
const action = resolveActionTypes(registry);
|
|
51
|
+
if (action.errors.length) {
|
|
52
|
+
return { errors: action.errors.map((e) => `action-type registry invalid: ${e}`), block: null, skills: {} };
|
|
53
|
+
}
|
|
54
|
+
const loaded = await loadSkills({
|
|
55
|
+
installRoot,
|
|
56
|
+
registry,
|
|
57
|
+
registeredActionTypes: Object.keys(action.effective),
|
|
58
|
+
});
|
|
59
|
+
if (loaded.errors.length) return { errors: loaded.errors, block: null, skills: {} };
|
|
60
|
+
return { errors: [], block: buildSkillDiscoveryBlock(loaded.skills), skills: loaded.skills };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export async function refreshSkillDiscovery({ installRoot, domain, registry }) {
|
|
64
|
+
const agentsPath = join(installRoot, 'domains', domain, 'AGENTS.md');
|
|
65
|
+
const rendered = await buildSkillDiscoveryForRegistry({ installRoot, registry });
|
|
66
|
+
if (rendered.errors.length) {
|
|
67
|
+
throw new Error(`cannot render AGENTS.md skill discovery: ${rendered.errors.join('; ')}`);
|
|
68
|
+
}
|
|
69
|
+
const agents = await readFile(agentsPath, 'utf8');
|
|
70
|
+
await fse.writeFile(agentsPath, replaceSkillDiscoveryBlock(agents, rendered.block));
|
|
71
|
+
return rendered;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function extractSkillDiscoveryBlock(agents) {
|
|
75
|
+
const start = agents.indexOf(SKILL_DISCOVERY_BEGIN);
|
|
76
|
+
const end = agents.indexOf(SKILL_DISCOVERY_END);
|
|
77
|
+
if (start === -1 || end === -1 || end < start) return null;
|
|
78
|
+
return agents.slice(start, end + SKILL_DISCOVERY_END.length);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export async function checkSkillDiscoveryStaleness({ installRoot }) {
|
|
82
|
+
let registry;
|
|
83
|
+
try {
|
|
84
|
+
registry = await fse.readJson(join(installRoot, '.phronesis', 'registry.json'));
|
|
85
|
+
} catch (err) {
|
|
86
|
+
return [{ domain: null, message: `could not read .phronesis/registry.json for skill discovery: ${err.message}` }];
|
|
87
|
+
}
|
|
88
|
+
const domains = Array.isArray(registry.domains) ? registry.domains : [];
|
|
89
|
+
const rendered = await buildSkillDiscoveryForRegistry({ installRoot, registry });
|
|
90
|
+
if (rendered.errors.length) {
|
|
91
|
+
return rendered.errors.map((e) => ({ domain: null, message: `cannot recompute AGENTS.md skill discovery: ${e}` }));
|
|
92
|
+
}
|
|
93
|
+
const expectedTable = extractSkillDiscoveryBlock(rendered.block);
|
|
94
|
+
const findings = [];
|
|
95
|
+
for (const domain of domains) {
|
|
96
|
+
const rel = `domains/${domain}/AGENTS.md`;
|
|
97
|
+
let agents;
|
|
98
|
+
try {
|
|
99
|
+
agents = await readFile(join(installRoot, rel), 'utf8');
|
|
100
|
+
} catch (err) {
|
|
101
|
+
findings.push({ domain, message: `${rel}: could not read AGENTS.md (${err.message})` });
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
const actualTable = extractSkillDiscoveryBlock(agents);
|
|
105
|
+
if (!actualTable) {
|
|
106
|
+
findings.push({ domain, message: `${rel}: missing skill-discovery marker block` });
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (actualTable !== expectedTable) {
|
|
110
|
+
findings.push({
|
|
111
|
+
domain,
|
|
112
|
+
message: `${rel}: skill discovery table is stale; regenerate from .phronesis/registry.json and skills/*/SKILL.md`,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return findings;
|
|
117
|
+
}
|