@esoteric-logic/praxis-harness 2.17.0 → 3.0.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 (55) hide show
  1. package/README.md +60 -0
  2. package/base/hooks/settings-hooks.json +4 -4
  3. package/base/hooks/stop-prompt-gate.sh +88 -0
  4. package/base/skills/px-prompt/SKILL.md +695 -87
  5. package/bin/praxis.js +73 -1
  6. package/bin/prompt-compile.js +124 -21
  7. package/bin/prompt-knowledge.js +152 -0
  8. package/lib/assemblers.js +25 -6
  9. package/lib/loader.js +172 -13
  10. package/package.json +3 -2
  11. package/prompts/blocks/behaviors/first-action-rule.md +21 -0
  12. package/prompts/blocks/behaviors/no-flattery.md +1 -2
  13. package/prompts/blocks/behaviors/phase-aware-reasoning.md +41 -0
  14. package/prompts/blocks/behaviors/radical-candor.md +23 -0
  15. package/prompts/blocks/context/mcp-servers.md +1 -1
  16. package/prompts/blocks/domains/federal-cost-analysis.md +33 -0
  17. package/prompts/blocks/domains/govcon-capture.md +89 -0
  18. package/prompts/blocks/domains/govcon-proposal.md +153 -0
  19. package/prompts/blocks/domains/pamasi-framework.md +58 -0
  20. package/prompts/blocks/domains/proposal-writing-rules.md +59 -0
  21. package/prompts/blocks/domains/red-team-review.md +45 -0
  22. package/prompts/blocks/formats/perplexity-generation.md +37 -0
  23. package/prompts/blocks/formats/scorecard-output.md +51 -0
  24. package/prompts/blocks/identity/federal-deal-sa.md +81 -0
  25. package/prompts/blocks/skills/mermaid-diagrams.md +39 -0
  26. package/prompts/{projects → personal}/praxis/CLAUDE.md +2 -3
  27. package/prompts/personal/praxis/project-instructions-claude-desktop.md +30 -0
  28. package/prompts/{projects → personal}/praxis/space-instructions-perplexity.md +2 -1
  29. package/prompts/profiles/_base.yaml +1 -0
  30. package/prompts/profiles/maximus-sa.yaml +27 -0
  31. package/prompts/projects/_template/prompt-config.yaml +4 -0
  32. package/prompts/templates/knowledge/architecture-constraints.md +19 -0
  33. package/prompts/templates/knowledge/corporate-reference.md +25 -0
  34. package/prompts/templates/knowledge/deal-context.md +27 -0
  35. package/prompts/work/elect/client-config.yaml +9 -0
  36. package/prompts/work/maximus/client-config.yaml +81 -0
  37. package/prompts/{projects/maximus/system-prompt.md → work/maximus/deals/dha-tricare/CLAUDE.md} +279 -314
  38. package/prompts/work/maximus/deals/dha-tricare/knowledge/deal-context.md +21 -0
  39. package/prompts/work/maximus/deals/dha-tricare/knowledge/maximus-corporate.md +30 -0
  40. package/prompts/work/maximus/deals/dha-tricare/project-instructions-claude-desktop.md +58 -0
  41. package/prompts/work/maximus/deals/dha-tricare/prompt-config.yaml +41 -0
  42. package/prompts/work/maximus/deals/dha-tricare/references/dha-tricare-intel.md +104 -0
  43. package/prompts/work/maximus/deals/dha-tricare/space-instructions-perplexity.md +42 -0
  44. package/prompts/work/maximus/references/maximus-corporate.md +39 -0
  45. package/prompts/projects/maximus/prompt-config.yaml +0 -13
  46. package/prompts/projects/maximus/space-instructions-perplexity.md +0 -67
  47. package/prompts/projects/praxis/project-instructions-claude-desktop.md +0 -24
  48. /package/prompts/{projects → personal}/praxis/prompt-config.yaml +0 -0
  49. /package/prompts/{projects/elect-azure → work/elect/deals/azure-architecture}/CLAUDE.md +0 -0
  50. /package/prompts/{projects/elect-azure → work/elect/deals/azure-architecture}/prompt-config.yaml +0 -0
  51. /package/prompts/{projects/elect-azure → work/elect/deals/azure-architecture}/space-instructions-perplexity.md +0 -0
  52. /package/prompts/{projects/elect-azure → work/elect/deals/azure-architecture}/system-prompt.md +0 -0
  53. /package/prompts/{projects → work}/maximus/references/maturity-questions.md +0 -0
  54. /package/prompts/{projects → work}/maximus/references/phase-maturity-matrix.md +0 -0
  55. /package/prompts/{projects → work}/maximus/references/proposal-writing-standards.md +0 -0
package/README.md CHANGED
@@ -79,6 +79,66 @@ For technical research: `/px-discover` (structured options evaluation before dec
79
79
  | `px-context-probe` | Assess context health and recommend action |
80
80
  | `px-context-reset` | Reload context from vault without clearing session |
81
81
 
82
+ ## Prompt Engine
83
+
84
+ Build and manage system prompts for Claude Projects, Perplexity Spaces, and Claude Code from a single source of truth.
85
+
86
+ ### Quick reference
87
+
88
+ | Command | What it does |
89
+ |---------|-------------|
90
+ | `/px-prompt my-project` | Create a new project (1 question — describe it) |
91
+ | `/px-prompt --deal irs-masterfile` | New Maximus capture deal (0 questions — Perplexity researches) |
92
+ | `/px-prompt --deal benefeds --type recompete` | New deal with explicit type |
93
+ | `/px-prompt --advance irs-masterfile` | Move deal to next capture phase |
94
+ | `/px-prompt --edit my-project "add NIST 800-53"` | Edit one section, auto-regenerate outputs |
95
+ | `/px-prompt --refresh my-project` | Re-run Perplexity research, diff and update |
96
+ | `/px-prompt --deploy my-project` | Copy outputs to clipboard with platform URLs |
97
+ | `/px-prompt --dashboard` | Project index with budgets and staleness |
98
+ | `/px-prompt --sync` | Recompile all projects, show diffs |
99
+ | `/px-prompt --scan my-project` | Full quality and budget audit |
100
+
101
+ ### Deal lifecycle (Maximus captures)
102
+
103
+ ```
104
+ /px-prompt --deal irs-masterfile # Create — Perplexity researches from name alone
105
+ /px-prompt --advance irs-masterfile # Shaping → Mid Capture
106
+ /px-prompt --advance irs-masterfile # Mid Capture → Pre-Proposal
107
+ /px-prompt --refresh irs-masterfile # Re-run OSINT before submission
108
+ /px-prompt --advance irs-masterfile # Pre-Proposal → Pre-Submission
109
+ /px-prompt --deploy irs-masterfile # Copy to clipboard, paste to platforms
110
+ ```
111
+
112
+ ### Deal types
113
+
114
+ | Type | Flag | When | Emphasis |
115
+ |------|------|------|----------|
116
+ | Recompete | `--type recompete` | Incumbent holds the contract | Defense, ghost matrix, transition |
117
+ | New Start | `--type new-start` | No incumbent, fresh opportunity | Discovery, innovation, OSINT |
118
+ | Task Order | `--type task-order` | Competing on existing IDIQ/BPA | Speed, rates, vehicle history |
119
+ | IDIQ/BPA | `--type idiq` | Winning the vehicle itself | Broad capabilities, teaming |
120
+
121
+ Auto-detected from research if `--type` not specified.
122
+
123
+ ### Non-Maximus projects
124
+
125
+ ```
126
+ /px-prompt cybersecurity-advisor # Describe it → inference engine → research → deploy
127
+ /px-prompt elect-azure # Work on existing project
128
+ ```
129
+
130
+ Any project — federal, enterprise, personal. The engine infers role, domains, and platforms from your description.
131
+
132
+ ### CLI tools (direct use)
133
+
134
+ ```bash
135
+ node bin/prompt-compile.js --dashboard # Project dashboard
136
+ node bin/prompt-compile.js --sync # Recompile all projects
137
+ node bin/prompt-compile.js <project> # Compile one project
138
+ node bin/prompt-knowledge.js <project> # Render knowledge pack templates
139
+ node bin/prompt-blocks.js --category domains # List available blocks
140
+ ```
141
+
82
142
  ## Rules
83
143
 
84
144
  16 rules across universal and scoped categories. Universal rules load every session. Scoped rules load only when matching file patterns are detected.
@@ -63,16 +63,16 @@
63
63
  "matcher": "",
64
64
  "hooks": [
65
65
  {
66
- "type": "prompt",
67
- "prompt": "Run the project test suite. Read CLAUDE.md ## Commands for the test command. If no test command defined, respond {ok:true}. Run tests. If all pass: respond {ok:true}. If tests fail: respond {ok:false, reason:'Tests failing: <summary>'}. Do not fix — only report."
66
+ "type": "command",
67
+ "command": "bash ~/.claude/hooks/stop-prompt-gate.sh test-runner"
68
68
  },
69
69
  {
70
70
  "type": "command",
71
71
  "command": "bash ~/.claude/hooks/session-data-collect.sh"
72
72
  },
73
73
  {
74
- "type": "prompt",
75
- "prompt": "You are completing a session. Perform these vault updates silently — no confirmation needed.\n\n1. Read vault_path from ~/.claude/praxis.config.json. If missing: skip all steps.\n2. Read {vault_path}/.session-staging.json if it exists (structured session data from hooks).\n3. Update {vault_path}/status.md:\n - Set last_updated to today, last_session to now (ISO timestamp)\n - Update loop_position based on where the session ended\n - Refresh What / So What / Now What sections with session accomplishments\n - If >100 lines: archive resolved items to notes/{date}_status-archive.md\n4. Update {vault_path}/claude-progress.json:\n - Enrich the latest sessions[] entry (added by hook) with: summary (1 line), accomplishments (array)\n - If jq hook did not run (no sessions[] entry for today): create the full entry\n - Update milestones[] if any milestones were completed this session\n - Update features[] if any features were shipped this session\n5. Write {vault_path}/notes/{YYYY-MM-DD}_session-note.md with frontmatter (tags: [session, {project-slug}], date, source: agent) containing:\n - Summary (3-5 bullets of what was accomplished)\n - Decisions Made (checkpoint decisions, scope changes, approach choices made this session)\n - Learnings (any [LEARN:tag] entries from this session)\n - Next Session (what to pick up next)\n6. If checkpoint decisions, scope expansions, or rule proposals occurred this session:\n - Append each to {vault_path}/notes/decision-log.md with date, decision type, context, decision, and rationale\n7. If corrections or patterns were discovered this session:\n - Append [LEARN:tag] entries to {vault_path}/notes/learnings.md following the existing format\n8. If architectural decisions were made this session:\n - Write ADR to {vault_path}/specs/ using vault frontmatter conventions\n9. Delete {vault_path}/.session-staging.json if it exists.\n\nKeep all writes concise. Use [[wikilinks]] for internal references. Follow existing YAML frontmatter conventions. If vault_path is missing or vault is inaccessible: skip silently. Do not ask permission — this is automatic housekeeping."
74
+ "type": "command",
75
+ "command": "bash ~/.claude/hooks/stop-prompt-gate.sh vault-update"
76
76
  }
77
77
  ]
78
78
  }
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/env bash
2
+ # stop-prompt-gate.sh — Gates Stop prompt hooks behind session activity detection.
3
+ # Only outputs the prompt text if the session had substantive work.
4
+ # Silent exit otherwise — prevents infinite Stop hook loops.
5
+ #
6
+ # Usage in settings-hooks.json:
7
+ # { "type": "command", "command": "bash ~/.claude/hooks/stop-prompt-gate.sh vault-update" }
8
+ # { "type": "command", "command": "bash ~/.claude/hooks/stop-prompt-gate.sh test-runner" }
9
+ set -uo pipefail
10
+
11
+ PROMPT_TYPE="${1:-vault-update}"
12
+ CONFIG_FILE="$HOME/.claude/praxis.config.json"
13
+
14
+ # ── Detect session activity ──
15
+ HAS_RECENT_COMMITS=false
16
+ HAS_DIRTY_TREE=false
17
+
18
+ RECENT=$(git --no-pager log --oneline --since="1 hour ago" 2>/dev/null | head -1)
19
+ if [[ -n "$RECENT" ]]; then
20
+ HAS_RECENT_COMMITS=true
21
+ fi
22
+
23
+ DIRTY=$(git --no-pager status --porcelain 2>/dev/null | head -1)
24
+ if [[ -n "$DIRTY" ]]; then
25
+ HAS_DIRTY_TREE=true
26
+ fi
27
+
28
+ # Check staging file from session-data-collect.sh
29
+ STAGING_DIRTY=false
30
+ if [[ -f "$CONFIG_FILE" ]]; then
31
+ VAULT_PATH=$(jq -r '.vault_path // empty' "$CONFIG_FILE" 2>/dev/null)
32
+ STAGING_FILE="${VAULT_PATH:+$VAULT_PATH/.session-staging.json}"
33
+ if [[ -n "$STAGING_FILE" && -f "$STAGING_FILE" ]]; then
34
+ STAGING_DIRTY=$(jq -r '.git.dirty // false' "$STAGING_FILE" 2>/dev/null)
35
+ fi
36
+ fi
37
+
38
+ # ── Gate: no activity → exit silently ──
39
+ if [[ "$HAS_RECENT_COMMITS" == "false" && "$HAS_DIRTY_TREE" == "false" && "$STAGING_DIRTY" != "true" ]]; then
40
+ exit 0
41
+ fi
42
+
43
+ # ── Activity detected — output the requested prompt ──
44
+ case "$PROMPT_TYPE" in
45
+ test-runner)
46
+ cat << 'PROMPT'
47
+ Run the project test suite. Read CLAUDE.md ## Commands for the test command. If no test command defined, respond {ok:true}. Run tests. If all pass: respond {ok:true}. If tests fail: respond {ok:false, reason:'Tests failing: <summary>'}. Do not fix — only report.
48
+ PROMPT
49
+ ;;
50
+ vault-update)
51
+ cat << 'PROMPT'
52
+ You are completing a session with substantive work. Perform these vault updates silently — no confirmation needed.
53
+
54
+ 1. Read vault_path from ~/.claude/praxis.config.json. If missing: skip all steps.
55
+ 2. Read {vault_path}/.session-staging.json if it exists (structured session data from hooks).
56
+ 3. Update {vault_path}/status.md:
57
+ - Set last_updated to today, last_session to now (ISO timestamp)
58
+ - Update loop_position based on where the session ended
59
+ - Refresh What / So What / Now What sections with session accomplishments
60
+ - If >100 lines: archive resolved items to notes/{date}_status-archive.md
61
+ 4. Update {vault_path}/claude-progress.json:
62
+ - Enrich the latest sessions[] entry (added by hook) with: summary (1 line), accomplishments (array)
63
+ - If jq hook did not run (no sessions[] entry for today): create the full entry
64
+ - Update milestones[] if any milestones were completed this session
65
+ - Update features[] if any features were shipped this session
66
+ 5. Write {vault_path}/notes/{YYYY-MM-DD}_session-note.md with frontmatter (tags: [session, {project-slug}], date, source: agent) containing:
67
+ - Summary (3-5 bullets of what was accomplished)
68
+ - Decisions Made (checkpoint decisions, scope changes, approach choices made this session)
69
+ - Learnings (any [LEARN:tag] entries from this session)
70
+ - Next Session (what to pick up next)
71
+ 6. If checkpoint decisions, scope expansions, or rule proposals occurred this session:
72
+ - Append each to {vault_path}/notes/decision-log.md with date, decision type, context, decision, and rationale
73
+ 7. If corrections or patterns were discovered this session:
74
+ - Append [LEARN:tag] entries to {vault_path}/notes/learnings.md following the existing format
75
+ 8. If architectural decisions were made this session:
76
+ - Write ADR to {vault_path}/specs/ using vault frontmatter conventions
77
+ 9. Delete {vault_path}/.session-staging.json if it exists.
78
+
79
+ Keep all writes concise. Use [[wikilinks]] for internal references. Follow existing YAML frontmatter conventions. If vault_path is missing or vault is inaccessible: skip silently. Do not ask permission — this is automatic housekeeping.
80
+ PROMPT
81
+ ;;
82
+ *)
83
+ echo "Unknown prompt type: $PROMPT_TYPE" >&2
84
+ exit 0
85
+ ;;
86
+ esac
87
+
88
+ exit 0