mishkan-harness 0.1.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.
Files changed (186) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +205 -0
  3. package/bin/mishkan.js +221 -0
  4. package/docs/design/MISHKAN_agent_aliases.md +140 -0
  5. package/docs/design/MISHKAN_decisions.md +172 -0
  6. package/docs/design/MISHKAN_harness_design.md +820 -0
  7. package/docs/design/MISHKAN_ontology.md +87 -0
  8. package/docs/design/MISHKAN_token_optimisation.md +181 -0
  9. package/docs/engineer/README.md +37 -0
  10. package/docs/engineer/profile.example.md +79 -0
  11. package/docs/usage/01-installation.md +178 -0
  12. package/docs/usage/02-project-init.md +151 -0
  13. package/docs/usage/03-orchestration.md +218 -0
  14. package/docs/usage/04-memory-layer.md +201 -0
  15. package/docs/usage/05-selective-ingest.md +177 -0
  16. package/docs/usage/06-llm-providers.md +195 -0
  17. package/docs/usage/07-troubleshooting.md +316 -0
  18. package/docs/usage/08-glossary.md +154 -0
  19. package/docs/usage/09-workflows.md +123 -0
  20. package/docs/usage/README.md +77 -0
  21. package/package.json +43 -0
  22. package/payload/install/settings.hooks.json +47 -0
  23. package/payload/mishkan/AGENT_SPEC.md +154 -0
  24. package/payload/mishkan/agents/ahikam.md +58 -0
  25. package/payload/mishkan/agents/aholiab.md +68 -0
  26. package/payload/mishkan/agents/asaph.md +73 -0
  27. package/payload/mishkan/agents/baruch.md +88 -0
  28. package/payload/mishkan/agents/benaiah.md +76 -0
  29. package/payload/mishkan/agents/bezalel.md +83 -0
  30. package/payload/mishkan/agents/caleb.md +74 -0
  31. package/payload/mishkan/agents/deborah.md +63 -0
  32. package/payload/mishkan/agents/elasah.md +58 -0
  33. package/payload/mishkan/agents/eliashib.md +68 -0
  34. package/payload/mishkan/agents/ezra.md +69 -0
  35. package/payload/mishkan/agents/hanun.md +64 -0
  36. package/payload/mishkan/agents/hiram.md +68 -0
  37. package/payload/mishkan/agents/hizkiah.md +76 -0
  38. package/payload/mishkan/agents/huldah.md +59 -0
  39. package/payload/mishkan/agents/huram.md +66 -0
  40. package/payload/mishkan/agents/hushai.md +59 -0
  41. package/payload/mishkan/agents/igal.md +58 -0
  42. package/payload/mishkan/agents/ira.md +86 -0
  43. package/payload/mishkan/agents/jahaziel.md +71 -0
  44. package/payload/mishkan/agents/jakin.md +66 -0
  45. package/payload/mishkan/agents/jehonathan.md +62 -0
  46. package/payload/mishkan/agents/jehoshaphat.md +68 -0
  47. package/payload/mishkan/agents/joab.md +71 -0
  48. package/payload/mishkan/agents/joah.md +62 -0
  49. package/payload/mishkan/agents/maaseiah.md +61 -0
  50. package/payload/mishkan/agents/meremoth.md +65 -0
  51. package/payload/mishkan/agents/meshullam.md +67 -0
  52. package/payload/mishkan/agents/nathan.md +70 -0
  53. package/payload/mishkan/agents/nehemiah.md +93 -0
  54. package/payload/mishkan/agents/obed.md +60 -0
  55. package/payload/mishkan/agents/oholiab.md +67 -0
  56. package/payload/mishkan/agents/palal.md +63 -0
  57. package/payload/mishkan/agents/phinehas.md +73 -0
  58. package/payload/mishkan/agents/rehum.md +60 -0
  59. package/payload/mishkan/agents/salma.md +69 -0
  60. package/payload/mishkan/agents/seraiah.md +73 -0
  61. package/payload/mishkan/agents/shallum.md +66 -0
  62. package/payload/mishkan/agents/shaphan.md +64 -0
  63. package/payload/mishkan/agents/shemaiah.md +67 -0
  64. package/payload/mishkan/agents/shevna.md +58 -0
  65. package/payload/mishkan/agents/uriah.md +70 -0
  66. package/payload/mishkan/agents/zaccur.md +58 -0
  67. package/payload/mishkan/agents/zadok.md +67 -0
  68. package/payload/mishkan/agents/zerubbabel.md +69 -0
  69. package/payload/mishkan/cognee/.env.curated.example +61 -0
  70. package/payload/mishkan/cognee/.env.example +165 -0
  71. package/payload/mishkan/cognee/Dockerfile +50 -0
  72. package/payload/mishkan/cognee/README.md +129 -0
  73. package/payload/mishkan/cognee/docker-compose.curated-ui.yml +61 -0
  74. package/payload/mishkan/cognee/docker-compose.curated.yml +85 -0
  75. package/payload/mishkan/cognee/docker-compose.hardening.yml +16 -0
  76. package/payload/mishkan/cognee/docker-compose.selfhosted.yml +114 -0
  77. package/payload/mishkan/cognee/docker-compose.ui.yml +70 -0
  78. package/payload/mishkan/cognee/docker-compose.yml +71 -0
  79. package/payload/mishkan/cognee/ingest-curated.py +92 -0
  80. package/payload/mishkan/commands/dep-audit.md +24 -0
  81. package/payload/mishkan/commands/mishkan-init.md +25 -0
  82. package/payload/mishkan/commands/mishkan-resume.md +21 -0
  83. package/payload/mishkan/commands/promote.md +19 -0
  84. package/payload/mishkan/commands/sefer-pull.md +19 -0
  85. package/payload/mishkan/commands/sprint-close.md +21 -0
  86. package/payload/mishkan/config/curated-library.yaml +113 -0
  87. package/payload/mishkan/config/improvement-queries.md +29 -0
  88. package/payload/mishkan/config/model-routing.yaml +87 -0
  89. package/payload/mishkan/config/projects.yaml +38 -0
  90. package/payload/mishkan/evals/baruch/README.md +93 -0
  91. package/payload/mishkan/evals/baruch/fixtures/invalid/bad-outcome-enum.json +15 -0
  92. package/payload/mishkan/evals/baruch/fixtures/invalid/bad-sprint-pattern.json +15 -0
  93. package/payload/mishkan/evals/baruch/fixtures/invalid/bad-trigger-enum.json +15 -0
  94. package/payload/mishkan/evals/baruch/fixtures/invalid/malformed-json.json +7 -0
  95. package/payload/mishkan/evals/baruch/fixtures/invalid/missing-required-field.json +14 -0
  96. package/payload/mishkan/evals/baruch/fixtures/valid/blocked-vendor.json +15 -0
  97. package/payload/mishkan/evals/baruch/fixtures/valid/curated-shortcircuit.json +15 -0
  98. package/payload/mishkan/evals/baruch/fixtures/valid/partial-no-write.json +14 -0
  99. package/payload/mishkan/evals/baruch/fixtures/valid/resolved-cross-harness.json +15 -0
  100. package/payload/mishkan/evals/baruch/golden_case/expected.yaml +35 -0
  101. package/payload/mishkan/evals/baruch/golden_case/input.yaml +47 -0
  102. package/payload/mishkan/evals/baruch/golden_case/produced.json +15 -0
  103. package/payload/mishkan/evals/baruch/run.sh +129 -0
  104. package/payload/mishkan/hooks/model-route.py +96 -0
  105. package/payload/mishkan/hooks/post-tool-observe.sh +45 -0
  106. package/payload/mishkan/hooks/pre-tool-security.sh +150 -0
  107. package/payload/mishkan/hooks/session-start.sh +20 -0
  108. package/payload/mishkan/hooks/stop-reporter.sh +29 -0
  109. package/payload/mishkan/ontology.md +87 -0
  110. package/payload/mishkan/rules/backend/yasad.md +23 -0
  111. package/payload/mishkan/rules/common/dependencies.md +53 -0
  112. package/payload/mishkan/rules/common/quality.md +16 -0
  113. package/payload/mishkan/rules/common/security.md +20 -0
  114. package/payload/mishkan/rules/documentation/sefer.md +19 -0
  115. package/payload/mishkan/rules/frontend/panim.md +21 -0
  116. package/payload/mishkan/rules/infrastructure/migdal.md +22 -0
  117. package/payload/mishkan/scripts/dependency-audit.sh +171 -0
  118. package/payload/mishkan/scripts/ensure-curated-box.sh +66 -0
  119. package/payload/mishkan/scripts/mishkan-ingest.sh +92 -0
  120. package/payload/mishkan/scripts/observability-aggregate.sh +57 -0
  121. package/payload/mishkan/scripts/seed-curated-library.sh +62 -0
  122. package/payload/mishkan/scripts/sync-profile.sh +65 -0
  123. package/payload/mishkan/scripts/validate-research-log.sh +108 -0
  124. package/payload/mishkan/skills/asaph-a11y-seo-craft/SKILL.md +289 -0
  125. package/payload/mishkan/skills/baruch-research-reporting-craft/SKILL.md +460 -0
  126. package/payload/mishkan/skills/benaiah-devsecops-craft/SKILL.md +329 -0
  127. package/payload/mishkan/skills/bezalel-cto-craft/SKILL.md +391 -0
  128. package/payload/mishkan/skills/caleb-web-research-craft/SKILL.md +306 -0
  129. package/payload/mishkan/skills/cognee-promote/SKILL.md +40 -0
  130. package/payload/mishkan/skills/cognee-quickstart/SKILL.md +66 -0
  131. package/payload/mishkan/skills/context-compress/SKILL.md +36 -0
  132. package/payload/mishkan/skills/deborah-ux-craft/SKILL.md +295 -0
  133. package/payload/mishkan/skills/dependency-audit/SKILL.md +59 -0
  134. package/payload/mishkan/skills/dependency-vetting/SKILL.md +59 -0
  135. package/payload/mishkan/skills/documentation-craft/SKILL.md +468 -0
  136. package/payload/mishkan/skills/ezra-research-formulation-craft/SKILL.md +319 -0
  137. package/payload/mishkan/skills/hanun-observability-craft/SKILL.md +312 -0
  138. package/payload/mishkan/skills/hiram-ui-craft/SKILL.md +334 -0
  139. package/payload/mishkan/skills/hizkiah-implementation-craft/SKILL.md +701 -0
  140. package/payload/mishkan/skills/hushai-security-advisor-craft/SKILL.md +282 -0
  141. package/payload/mishkan/skills/ira-code-security-craft/SKILL.md +553 -0
  142. package/payload/mishkan/skills/jakin-intent-clarification-craft/SKILL.md +299 -0
  143. package/payload/mishkan/skills/jehonathan-publication-craft/SKILL.md +262 -0
  144. package/payload/mishkan/skills/joab-app-security-craft/SKILL.md +266 -0
  145. package/payload/mishkan/skills/meremoth-devops-craft/SKILL.md +298 -0
  146. package/payload/mishkan/skills/meshullam-infra-design-craft/SKILL.md +302 -0
  147. package/payload/mishkan/skills/mishkan-ingest/SKILL.md +65 -0
  148. package/payload/mishkan/skills/mishkan-init/SKILL.md +65 -0
  149. package/payload/mishkan/skills/nathan-architecture-craft/SKILL.md +547 -0
  150. package/payload/mishkan/skills/nehemiah-pm-craft/SKILL.md +484 -0
  151. package/payload/mishkan/skills/obed-asset-pipeline-craft/SKILL.md +286 -0
  152. package/payload/mishkan/skills/oholiab-design-system-craft/SKILL.md +334 -0
  153. package/payload/mishkan/skills/palal-systems-craft/SKILL.md +281 -0
  154. package/payload/mishkan/skills/qa-evaluation-craft/SKILL.md +406 -0
  155. package/payload/mishkan/skills/rehum-sre-advisor-craft/SKILL.md +228 -0
  156. package/payload/mishkan/skills/reporter-discipline-craft/SKILL.md +351 -0
  157. package/payload/mishkan/skills/research-pipeline/SKILL.md +55 -0
  158. package/payload/mishkan/skills/salma-frontend-implementation-craft/SKILL.md +369 -0
  159. package/payload/mishkan/skills/sefer-pull/SKILL.md +37 -0
  160. package/payload/mishkan/skills/shallum-database-craft/SKILL.md +347 -0
  161. package/payload/mishkan/skills/shaphan-summarisation-craft/SKILL.md +271 -0
  162. package/payload/mishkan/skills/shemaiah-evaluation-craft/SKILL.md +342 -0
  163. package/payload/mishkan/skills/sprint-report/SKILL.md +28 -0
  164. package/payload/mishkan/skills/team-lead-craft/SKILL.md +457 -0
  165. package/payload/mishkan/skills/zadok-contract-craft/SKILL.md +520 -0
  166. package/payload/mishkan/templates/case-node.schema.json +22 -0
  167. package/payload/mishkan/templates/mcp.json +22 -0
  168. package/payload/mishkan/templates/observability-log.schema.json +24 -0
  169. package/payload/mishkan/templates/project-CLAUDE.md +47 -0
  170. package/payload/mishkan/templates/research-log.schema.json +40 -0
  171. package/payload/mishkan/templates/settings.json +12 -0
  172. package/payload/mishkan/templates/settings.local.json +6 -0
  173. package/payload/mishkan/templates/sprint-state.schema.json +47 -0
  174. package/payload/mishkan/templates/team-report.schema.json +50 -0
  175. package/payload/mishkan/templates/user-CLAUDE.md +62 -0
  176. package/payload/mishkan/workflows/README.md +88 -0
  177. package/payload/mishkan/workflows/mishkan-architecture-panel.js +156 -0
  178. package/payload/mishkan/workflows/mishkan-codebase-audit.js +188 -0
  179. package/payload/mishkan/workflows/mishkan-deep-research.js +251 -0
  180. package/payload/mishkan/workflows/mishkan-init.js +156 -0
  181. package/payload/mishkan/workflows/mishkan-migration-wave.js +180 -0
  182. package/payload/mishkan/workflows/mishkan-release-readiness.js +163 -0
  183. package/payload/mishkan/workflows/mishkan-sprint-close.js +112 -0
  184. package/payload/user/CLAUDE.md +62 -0
  185. package/payload/user/rules/engineer-standards.md +66 -0
  186. package/payload/user/rules/y4nn-standards.md +167 -0
@@ -0,0 +1,87 @@
1
+ # MISHKAN — Cognee Graph Ontology
2
+
3
+ The schema for the shared knowledge graph. Entity types are nodes; relationship
4
+ types are edges. The graph starts near-empty and grows through working sessions —
5
+ nothing is pre-seeded except the curated library (Phase 8).
6
+
7
+ This ontology is versioned in `harness/` so changes are reviewable. Schema drift
8
+ is expected; amend with a dated entry rather than rewriting silently.
9
+
10
+ ---
11
+
12
+ ## Entity types (nodes)
13
+
14
+ | Entity | Description | Key properties |
15
+ |---|---|---|
16
+ | **Agent** | One of the 45 MISHKAN agents | `alias`, `team`, `role`, `model_tier` |
17
+ | **Team** | One of the six teams | `name`, `hebrew`, `domain`, `lead_alias` |
18
+ | **Project** | A repo MISHKAN was initialised on | `name`, `path`, `stack`, `created_sprint` |
19
+ | **Sprint** | A delivery cycle within a project | `id` (S0, S1…), `project`, `started`, `closed`, `milestone` |
20
+ | **Task** | A scoped unit of work | `id` (T-N), `sprint`, `description`, `status`, `assigned_team`, `assigned_agent` |
21
+ | **Decision** | An architectural or scope decision | `id`, `made_by`, `sprint`, `summary`, `drivers`, `consequences`, `adr_ref` |
22
+ | **ResearchOutput** | A resolved research pipeline result | `id`, `agent`, `team`, `query_intent`, `summary`, `outcome`, `applied_to_task` |
23
+ | **CaseNode** | A problem solved using a curated resource | `team`, `agent`, `problem_class`, `resource_applied`, `resolution`, `outcome`, `sprint`, `task` |
24
+ | **CuratedResource** | A vetted professional reference | `name`, `url`, `team`, `problem_class`, `source_tier` |
25
+ | **Incident** | A documented failure + recovery | `id`, `date`, `service`, `root_causes[]`, `resolution`, `postmortem_ref` |
26
+ | **ADR** | Architecture Decision Record | `id`, `title`, `date`, `status`, `drivers`, `decision`, `consequences` |
27
+ | **RunbookProcedure** | An operational procedure | `id`, `title`, `service`, `trigger`, `steps_ref`, `status` |
28
+ | **SecurityFinding** | A finding from Mishmar | `id`, `severity`, `location`, `rule_violated`, `remediation`, `status`, `sprint` |
29
+ | **CuratedLibraryHit** | Telemetry: a curated resource was used | `resource`, `team`, `problem_class`, `sprint`, `count` |
30
+
31
+ ---
32
+
33
+ ## Relationship types (edges)
34
+
35
+ | Edge | From → To | Meaning |
36
+ |---|---|---|
37
+ | **member-of** | Agent → Team | agent belongs to team |
38
+ | **leads** | Agent → Team | agent is the team lead |
39
+ | **assigned-to** | Task → Agent / Team | who owns the task |
40
+ | **part-of** | Task → Sprint, Sprint → Project | hierarchy |
41
+ | **applies-to** | CuratedResource → Task / problem_class | resource is relevant here |
42
+ | **supersedes** | ADR → ADR, Decision → Decision, Doc → Doc | replaces a prior |
43
+ | **validated-by** | Decision → ResearchOutput / CaseNode | evidence backing a decision |
44
+ | **blocks** | Task → Task, SecurityFinding → Task | dependency / gate |
45
+ | **derives-from** | Decision → ResearchOutput, ADR → Decision | provenance |
46
+ | **escalated-to** | Task / Decision → Agent | who it was escalated to |
47
+ | **written-by** | ResearchOutput / Decision / CaseNode → Agent | authorship |
48
+ | **references** | any → any | loose citation link |
49
+ | **mitigates** | Decision / Task → SecurityFinding / Incident | what addresses a risk |
50
+ | **resolved-by** | Incident / SecurityFinding → Task / Decision | closure link |
51
+ | **uses** | CaseNode → CuratedResource | which resource solved the case |
52
+ | **documents** | ADR / RunbookProcedure → Decision / Incident / Task | doc covers this |
53
+
54
+ ---
55
+
56
+ ## Blast-radius tagging
57
+
58
+ Every node written to the graph carries a `blast_radius` property used by the
59
+ knowledge-promotion model (design §9):
60
+
61
+ - `agent-private` — stays in subagent MEMORY.md, not promoted to graph
62
+ (these generally do not reach Cognee at all).
63
+ - `team-level` — promoted by Team Lead; tagged with `team`.
64
+ - `cross-harness` — promoted by Nehemiah + Bezalel at sprint close; visible
65
+ to all agents.
66
+
67
+ Only `team-level` and `cross-harness` nodes live in Cognee. `agent-private`
68
+ knowledge stays in flat MEMORY.md files per the promotion model.
69
+
70
+ ---
71
+
72
+ ## Query patterns the improvement layer relies on
73
+
74
+ These saved queries (Phase 8) read the graph:
75
+
76
+ 1. **Most expensive agents per sprint** — `Agent` nodes with aggregated
77
+ observability metrics, ordered by cost.
78
+ 2. **Tools called most per team** — observability metrics grouped by `team`.
79
+ 3. **Blocker hot spots** — `Task` nodes with `blocks` edges, clustered.
80
+ 4. **Components accumulating findings** — `SecurityFinding` nodes grouped by
81
+ `location`.
82
+ 5. **Curated library hit rate per problem class** — `CuratedLibraryHit`
83
+ aggregated by `problem_class`, joined to `CuratedResource`.
84
+
85
+ ---
86
+
87
+ *Ontology v1, locked May 2026. Amend with dated entries on schema drift.*
@@ -0,0 +1,181 @@
1
+ # MISHKAN — Token Optimisation & Context Management
2
+
3
+ How the harness manages context and token usage **on top of Claude** — by
4
+ leveraging the platform's native primitives, not by replacing them. MISHKAN never
5
+ intercepts or rewrites a Claude request. It is a discipline of **input
6
+ composition**: arrange what enters each call so the Claude model's own cost and
7
+ context behaviour falls in the engineer's favour.
8
+
9
+ This is the operational detail behind §11 of `MISHKAN_harness_design.md`.
10
+
11
+ ---
12
+
13
+ ## 1. The cost model being optimised
14
+
15
+ Every agent run is one Claude API request. The model bills input tokens at two
16
+ rates and output at one:
17
+
18
+ ```
19
+ cost ≈ (uncached_input × 1.0) + (cached_input × ~0.1) + (output × 1.0)
20
+ ```
21
+
22
+ - **Cached input** — a prefix byte-identical to a recent call is read from cache
23
+ at roughly a tenth of the price (ephemeral cache, a few minutes' TTL).
24
+ - **Uncached input** — everything new or changed, at full price.
25
+ - **Output** — always full price.
26
+
27
+ Three levers follow directly, and every MISHKAN mechanism pulls one or more:
28
+ **(a) grow cached_input · (b) shrink uncached_input · (c) keep the whole window
29
+ small** so nothing resident wasn't needed.
30
+
31
+ ---
32
+
33
+ ## 2. Anatomy of one agent call
34
+
35
+ Claude Code assembles each request from fixed parts, in order. MISHKAN's
36
+ arrangement splits them into a stable, cacheable prefix and a variable suffix:
37
+
38
+ ```
39
+ ┌───────────────────────────────────────────────┐ ┐
40
+ │ system prompt (Claude Code core) │ │
41
+ │ agent definition (.md role block + tools) │ │ STABLE PREFIX
42
+ │ ~/.claude/CLAUDE.md (engineer identity) │ │ byte-identical
43
+ │ y4nn-standards + engineer-standards │ │ call-to-call
44
+ │ matched path-scoped rules │ │ → CACHEABLE (~0.1x)
45
+ ├───────────────────────────────────────────────┤ ┘
46
+ │ project ./CLAUDE.md (sprint state) │ ┐
47
+ │ task / conversation so far │ │ VARIABLE SUFFIX
48
+ │ tool results · Cognee summaries │ │ → full price
49
+ └───────────────────────────────────────────────┘ ┘
50
+ ```
51
+
52
+ Every agent file enforces this with a trailing `## Dynamic Context Injection
53
+ Point` marker: everything above it is stable and caches; the changing sprint
54
+ state and task sit below.
55
+
56
+ ---
57
+
58
+ ## 3. The five mechanisms — native primitive × MISHKAN formulation
59
+
60
+ | # | Claude primitive (native) | MISHKAN formulation (input-shaping) | Lever |
61
+ |---|---|---|---|
62
+ | 1 | **Prompt caching** of a stable prefix | "static first, dynamic last" ordering in every agent; standards/rules above the injection point stay byte-stable | grow cached |
63
+ | 2 | **Subagent isolation** — each Task subagent has its own context window | the 45-agent org; heavy work runs in disposable child windows, only summaries return to the parent | shrink window |
64
+ | 3 | **Per-agent tool grants** + deferred tool schemas | tight `tools:` per agent (QA has no Write, reporters no Bash, Jakin only Read) | shrink uncached |
65
+ | 4 | **Rule loading by glob match** | path-scoped team rules (33–39 globs each); only 3 `common/` rules are always-on | shrink uncached |
66
+ | 5 | **MCP external store** | Cognee offloading — full artifacts to the graph, summary + node-id in context (`context-compress` skill) | shrink window |
67
+
68
+ ### 3.1 Prompt caching — formulated by ordering
69
+
70
+ Caching fires only on a byte-identical prefix. Putting the role, standards, and
71
+ matched rules first makes them a stable prefix that caches; the variable task sits
72
+ last. Two calls to the same agent in a session pay full price only for what
73
+ differs:
74
+
75
+ ```
76
+ call #1 → Hizkiah: [role+standards+rules][task A] prefix WRITE (~1.25x once)
77
+ call #2 → Hizkiah: [role+standards+rules][task B] prefix HIT (~0.1x); only task B full price
78
+ ```
79
+
80
+ ### 3.2 Subagent isolation — formulated by decomposition (the biggest lever)
81
+
82
+ When an orchestrator routes via the Task tool, the specialist runs in its **own**
83
+ window. Its file reads, research, and scans never enter the parent's context; only
84
+ the final message returns. The main conversation stays lean regardless of how much
85
+ work happens beneath it.
86
+
87
+ ```
88
+ MAIN THREAD (lean) SUBAGENT WINDOWS (isolated, discarded)
89
+ Nehemiah ─Task─► Hizkiah ───────► [reads/edits ≈30k tokens of work]
90
+ returns ◄──────── "done: 3 files, contract held" (~200 tok)
91
+ ─Task─► Caleb ───────► [web research ≈25k tokens]
92
+ returns ◄──────── "PKCE S256; sources […]" (~300 tok)
93
+ ```
94
+
95
+ This is **why disabling auto-compaction is low-risk in MISHKAN**: the token-heavy
96
+ history is never on the main thread to compact — it was spent and dropped in child
97
+ windows. (See §5.)
98
+
99
+ ### 3.3 Tool grants — formulated by frontmatter
100
+
101
+ Each tool's JSON schema costs input tokens. Tight per-agent `tools:` lists mean an
102
+ agent never carries schemas for tools it cannot use.
103
+
104
+ ### 3.4 Rule scoping — formulated by globs
105
+
106
+ A rule's body is tokens. `backend/yasad.md` contributes **zero** while editing a
107
+ `.css`; it loads only when a matching path is touched. The rule budget tracks the
108
+ file in hand.
109
+
110
+ ### 3.5 Cognee offloading — formulated by externalising state
111
+
112
+ Context is not history. Instead of carrying a 3,000-token result forward, write it
113
+ to the graph and keep a ~150-token summary + node id; query for detail on demand.
114
+ This is the **deliberate, into-a-store** counterpart to letting the model
115
+ auto-summarise the conversation.
116
+
117
+ ---
118
+
119
+ ## 4. What "on top of Claude" means
120
+
121
+ ```
122
+ Claude model (caching · context window · tool-use) ← unchanged
123
+
124
+ │ MISHKAN shapes INPUTS only:
125
+ ┌───────────────────┴─────────────────────────────────────────┐
126
+ │ file ORDER → what caches (static-first) │
127
+ │ agent BOUNDARIES → what's resident (subagent fan-out) │
128
+ │ tool GRANTS → schema weight (tight tools:) │
129
+ │ glob SCOPES → rule weight (path-matched) │
130
+ │ store CHOICE → context vs graph (Cognee offload) │
131
+ └───────────────────────────────────────────────────────────────┘
132
+ ```
133
+
134
+ No request interception, no rewriting. The platform's native behaviour does the
135
+ work; MISHKAN composes the inputs so it works in the engineer's favour.
136
+
137
+ ---
138
+
139
+ ## 5. Interaction with auto-compaction
140
+
141
+ Auto-compaction (Claude Code native) summarises older context when the window
142
+ fills, so long sessions don't hit a wall. The engineer runs with
143
+ `autoCompactEnabled: false` — preferring exact, un-rewritten context (consistent
144
+ with verify-before-fix and no-fabrication).
145
+
146
+ MISHKAN makes that safe in the common path because:
147
+
148
+ - **Subagent isolation** keeps the heavy history off the main thread.
149
+ - **Cognee offloading** is the manual, reviewed substitute for auto-summarisation.
150
+ - **CLAUDE.md re-injection** reloads sprint state from file, not from a summary.
151
+
152
+ **Where compaction-off still bites:** a long exploration chat with
153
+ Nehemiah/Bezalel that never spawns a subagent accumulates on the main thread with
154
+ no auto-rescue. Mitigation is manual: `/context-compress`, or capture intent into
155
+ `/mishkan-init` and start a fresh session.
156
+
157
+ ---
158
+
159
+ ## 6. Model tiering (cost, complementary to tokens)
160
+
161
+ Tokens and model choice are separate cost axes. `config/model-routing.yaml` sets a
162
+ Claude tier per agent role: **Opus** for orchestration/leads, **Sonnet** for any
163
+ agent that writes code/config, **Haiku** for evaluate/collect/advise roles. Tiering
164
+ cuts cost without touching the token mechanics above.
165
+
166
+ ---
167
+
168
+ ## 7. Targets and honest gaps
169
+
170
+ - **Budget target:** under ~10 active MCPs and ~80 loaded tools at any time.
171
+ Currently discipline + per-agent `tools:` lists — **not an enforced gate**.
172
+ - **Cache-hit measurement** is aspirational: the PostToolUse hook captures
173
+ tool/outcome but not token/cache fields (the hook payload doesn't expose them),
174
+ so cache-hit-rate must be derived Cognee-side once enriched.
175
+ - **Auto-compaction is off** by setting; §5 covers the implications.
176
+
177
+ ---
178
+
179
+ *Operational detail for `MISHKAN_harness_design.md` §11. Mechanisms are native to
180
+ the Claude model and Claude Code; MISHKAN's contribution is the input composition
181
+ that makes them pay off.*
@@ -0,0 +1,37 @@
1
+ # Engineer Profile — canonical, replaceable
2
+
3
+ This directory holds the **single source of truth** for the engineer the harness
4
+ serves. It is meant to be edited or replaced by the engineer.
5
+
6
+ | File | Role |
7
+ |---|---|
8
+ | `profile.md` | Canonical, agent-loadable profile. This is what MISHKAN agents load as engineer context (copied at install/sync to `~/.claude/mishkan/profile.md`). |
9
+ | `profile-readable.md` | Human-readable narrative companion. Reference, not loaded by agents. |
10
+
11
+ ## How it propagates
12
+
13
+ `profile.md` is the source. Two layers consume it:
14
+
15
+ 1. **Mechanical (a script):** `scripts/sync-profile.sh` copies `profile.md` →
16
+ `~/.claude/mishkan/profile.md` (the runtime path every reference points at) and
17
+ audits the harness for stale references. Run it after any edit, or at install.
18
+
19
+ 2. **Semantic (an agent):** **Seraiah** (Sefer org-layer) owns re-deriving the
20
+ digests that were drawn *from* the profile when it materially changes — the
21
+ non-negotiables block in the user-level `CLAUDE.md` and any engineering-identity
22
+ docs. The script moves bytes; Seraiah keeps meaning in sync.
23
+
24
+ ## Replacing the profile (another engineer adopting MISHKAN)
25
+
26
+ Drop your own `profile.md` here (keep the section structure — identity, how you
27
+ think, stack, practice, AI-collaboration, strengths), run `scripts/sync-profile.sh`,
28
+ then ask Seraiah to re-derive the user-level `CLAUDE.md` non-negotiables. Nothing
29
+ else in the harness hardcodes the previous engineer.
30
+
31
+ ## What references this profile
32
+
33
+ - `~/.claude/CLAUDE.md` (user-level identity → non-negotiables digest)
34
+ - `~/.claude/mishkan/agents/seraiah.md` (org-layer identity owner)
35
+ - runtime load path: `~/.claude/mishkan/profile.md`
36
+
37
+ Run `scripts/sync-profile.sh --check` to list current references and flag drift.
@@ -0,0 +1,79 @@
1
+ ---
2
+ name: engineer-profile
3
+ description: Canonical engineer profile loaded as context by MISHKAN agents. THIS IS A SANITIZED EXAMPLE — copy to profile.md and fill with your own details. profile.md is gitignored; never commit real names, employers, hosts, IPs, or credentials.
4
+ type: developer_profile
5
+ version: 1.0
6
+ scope: agent-loadable
7
+ language: en
8
+ ---
9
+
10
+ # Engineer Profile — EXAMPLE
11
+
12
+ > Copy this file to `profile.md` (same directory) and replace every placeholder
13
+ > with your own details, then run `scripts/sync-profile.sh`. `profile.md` is
14
+ > gitignored so your real profile never enters the public repo. Keep the section
15
+ > structure — agents rely on it.
16
+ >
17
+ > **Never put secrets, production IPs, internal hostnames, or other people's names
18
+ > in a profile that will be published.** Operational specifics belong in your local
19
+ > `profile.md`, not here.
20
+
21
+ ## 0. Identity
22
+
23
+ ```yaml
24
+ name: <your name>
25
+ handle: <your handle>
26
+ github: <username>
27
+ languages: [<spoken/working languages>]
28
+ title: <your title>
29
+ focus: <what you build — e.g. backend, infra, frontend, ML>
30
+ ```
31
+
32
+ ## 1. How you think about engineering
33
+
34
+ A few sentences on your engineering philosophy. Examples of the kind of thing
35
+ agents use: do you sequence design before code? verify before fixing? prefer
36
+ durable solutions over workarounds? hold tight scope? State it plainly with the
37
+ *why*, because agents apply principles they understand.
38
+
39
+ ## 2. How you work with AI
40
+
41
+ ```yaml
42
+ delegation:
43
+ high: [<work you delegate freely — e.g. UI, config, boilerplate>]
44
+ zero: [<work AI must never execute — e.g. git push, prod ssh, sudo, migrations>]
45
+ prompting_style: <terse/structured/exploratory…>
46
+ non_negotiables: [<your hard rules>]
47
+ ```
48
+
49
+ ## 3. Stack
50
+
51
+ ```yaml
52
+ languages: [<languages you ship in>]
53
+ frontend: [<frameworks/tools>]
54
+ backend: [<frameworks/tools>]
55
+ data: [<databases>]
56
+ infra: [<containers, CI, cloud, IaC>]
57
+ security: [<practices/tools>]
58
+ ai_ml: [<if applicable>]
59
+ ```
60
+
61
+ ## 4. Engineering practice
62
+
63
+ - **Version control:** <commit conventions, branching>
64
+ - **Deployment:** <how you ship>
65
+ - **Documentation:** <who you write for, what depth>
66
+ - **Testing:** <your bar>
67
+
68
+ ## 5. Strengths
69
+
70
+ - <evidence-anchored strengths — what you're genuinely good at>
71
+
72
+ ## 6. Focus / growth areas
73
+
74
+ - <what you're deepening — skills, practices, tooling>
75
+
76
+ ---
77
+
78
+ *Sanitized example. Real profile lives in `profile.md` (gitignored). See
79
+ `docs/engineer/README.md` for the propagation model.*
@@ -0,0 +1,178 @@
1
+ # 01 — Installation
2
+
3
+ > Goal: get MISHKAN installed and running on a host so the next session in any
4
+ > project picks it up automatically.
5
+
6
+ ## Prerequisites
7
+
8
+ | Need | Why | How to check |
9
+ |---|---|---|
10
+ | **Claude Code** | the runtime | `claude --version` (≥ 2.x) |
11
+ | **Node 18+** | the installer (`bin/mishkan.js`) is dependency-free Node | `node --version` |
12
+ | **Docker** | the cognee memory stack runs locally in containers | `docker --version`, `docker ps` |
13
+ | **Disk** | ~20 GB free (Neo4j volumes, ollama models, postgres) | `df -h` |
14
+ | **`tsh` (optional)** | only if you're on a remote VPS and need to view the cognee UIs / Neo4j Browsers locally | `tsh version` |
15
+
16
+ The harness assumes a **single-user** machine. Multi-tenant scenarios are not
17
+ designed for and a few defaults (e.g. cognee's access control off) reflect that
18
+ (see [Memory layer](./04-memory-layer.md) and [D-007](../design/MISHKAN_decisions.md)).
19
+
20
+ ## What gets installed where
21
+
22
+ Two target areas, distinct on purpose:
23
+
24
+ ```
25
+ ~/.claude/ ← user-level Claude Code config
26
+ ├── CLAUDE.md ← MISHKAN identity, loads on every session
27
+ ├── rules/
28
+ │ ├── y4nn-standards.md ← harness-maintained defaults (refreshed on update)
29
+ │ └── engineer-standards.md ← YOUR override layer (installer never touches it)
30
+ ├── settings.json ← hooks merged in (existing hooks preserved)
31
+ └── mishkan/ ← everything MISHKAN under one prefix
32
+ ├── agents/ (45) ← Claude Code subagent definitions
33
+ ├── rules/ ← common + path-scoped team rules (JIT load)
34
+ ├── hooks/ ← security · observability · model-route · reporter
35
+ ├── skills/ (10+) ← orchestrated workflows
36
+ ├── commands/ ← /mishkan-init, /sprint-close, /promote, …
37
+ ├── config/ ← model-routing.yaml, curated-library.yaml
38
+ └── cognee/ ← Docker Compose stack for the memory layer
39
+ ```
40
+
41
+ Per project, [`/mishkan-init`](./02-project-init.md) later seeds:
42
+
43
+ ```
44
+ <project>/
45
+ ├── CLAUDE.md ← project state (sprint slot)
46
+ ├── .mcp.json ← cognee MCP connections (work + curated)
47
+ └── .claude/
48
+ ├── rules/ ← team rules copied for path-scoped loading
49
+ ├── settings.json ← deny-list (git push, ssh, sudo, docker exec)
50
+ └── settings.local.json ← gitignored local allow-list
51
+ ```
52
+
53
+ ## Install
54
+
55
+ From a clone of the harness repo:
56
+
57
+ ```bash
58
+ cd ~/path/to/harness
59
+ node bin/mishkan.js install
60
+ ```
61
+
62
+ Or via npx (after publishing — not done as of this writing):
63
+
64
+ ```bash
65
+ npx mishkan-harness install
66
+ ```
67
+
68
+ What the installer does (read `bin/mishkan.js` for the full list):
69
+
70
+ 1. Copies `payload/user/rules/*` → `~/.claude/rules/` (refreshing `y4nn-standards.md`,
71
+ installing `engineer-standards.md` once if absent).
72
+ 2. Copies `payload/mishkan/*` → `~/.claude/mishkan/` under one clean prefix.
73
+ 3. Symlinks `payload/mishkan/commands/*` → `~/.claude/commands/` (only if no
74
+ filename collision with existing user commands).
75
+ 4. Merges `payload/install/settings.hooks.json` into `~/.claude/settings.json`,
76
+ resolving the `{{MISHKAN}}` placeholder to the absolute install path.
77
+ **Existing hooks are preserved** (dedupe is by exact command string).
78
+ 5. Writes an install stamp (version + timestamp) for `status` to read later.
79
+
80
+ ## Verify the install
81
+
82
+ ```bash
83
+ # layout
84
+ ls -la ~/.claude/mishkan/
85
+
86
+ # hooks merged
87
+ python3 -c "import json; d=json.load(open('$HOME/.claude/settings.json'));
88
+ print([ (e['matcher'], [h['command'] for h in e['hooks']]) for e in d['hooks']['PreToolUse']])"
89
+ # expected matchers include: Write|Edit|MultiEdit, Task|Agent
90
+
91
+ # model-routing hook is registered (live behaviour)
92
+ python3 -c "import json; d=json.load(open('$HOME/.claude/settings.json'));
93
+ assert any('model-route.py' in h['command']
94
+ for e in d['hooks']['PreToolUse']
95
+ for h in e['hooks']), 'model-route hook missing'
96
+ print('model-route hook: OK')"
97
+
98
+ # install stamp
99
+ cat ~/.claude/mishkan/.install-stamp.json 2>/dev/null
100
+ ```
101
+
102
+ ## Bring the cognee memory stack up
103
+
104
+ The harness ships the memory layer as a Docker Compose stack. Two boxes:
105
+ **work** (per-project knowledge, port `:7777`) and **curated** (shared reference
106
+ library, port `:7730`). See [memory layer](./04-memory-layer.md) for the
107
+ full design.
108
+
109
+ ```bash
110
+ cd ~/.claude/mishkan/cognee
111
+
112
+ # 1. secrets — start from the example, SOPS-manage the real .env later
113
+ cp .env.example .env
114
+ # … fill LLM_API_KEY and pick a provider profile (see chapter 06)
115
+
116
+ # 2. bring up the work stack (always with the hardening overlay)
117
+ docker compose -f docker-compose.yml -f docker-compose.hardening.yml up -d --build
118
+
119
+ # 3. bring up the curated box (one-time per host, idempotent helper)
120
+ bash ~/.claude/mishkan/scripts/ensure-curated-box.sh
121
+
122
+ # 4. seed the curated reference library (96 nodes; runs cognify→memify)
123
+ bash ~/.claude/mishkan/scripts/seed-curated-library.sh
124
+ ```
125
+
126
+ Health checks:
127
+
128
+ ```bash
129
+ docker ps --filter 'name=mishkan-' --format '{{.Names}}\t{{.Status}}'
130
+ # expected (all "healthy" once warm):
131
+ # mishkan-cognee-mcp / -neo4j / -pg / -backend / -frontend
132
+ # mishkan-curated-mcp / -neo4j
133
+ # mishkan-ollama
134
+ # (if curated UI overlay enabled) mishkan-curated-backend / -frontend
135
+
136
+ curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:7777/mcp # 406 = healthy (no MCP handshake)
137
+ curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:7730/mcp # 406 = healthy
138
+ ```
139
+
140
+ ## Upgrade
141
+
142
+ Re-run the installer. The default standards file (`y4nn-standards.md`) is
143
+ refreshed; **`engineer-standards.md` is left alone** so your customisations
144
+ survive across updates. The hook fragment is merged additively.
145
+
146
+ ## Uninstall
147
+
148
+ ```bash
149
+ node bin/mishkan.js uninstall
150
+ ```
151
+
152
+ Removes:
153
+ - `~/.claude/mishkan/` entirely.
154
+ - Symlinks under `~/.claude/commands/` that point into the mishkan tree.
155
+ - Hook entries whose command paths include `/mishkan/hooks/` are stripped from
156
+ `~/.claude/settings.json` (your own hooks remain).
157
+
158
+ Does **not** remove:
159
+ - `~/.claude/rules/` (you may keep, archive, or delete by hand).
160
+ - The cognee Docker volumes (use `docker compose down -v` from
161
+ `~/.claude/mishkan/cognee/` if you also want to wipe the graph).
162
+
163
+ ## Status
164
+
165
+ ```bash
166
+ node bin/mishkan.js status
167
+ ```
168
+
169
+ Prints version, install timestamp, and a quick layout check.
170
+
171
+ ## See also
172
+
173
+ - Up next: [Project initialisation](./02-project-init.md) — running
174
+ `/mishkan-init` in a project directory.
175
+ - [LLM provider profiles](./06-llm-providers.md) — choosing what powers the
176
+ cognee LLM/embedding calls.
177
+ - Live install record (D-005 npm package): [`docs/design/MISHKAN_decisions.md`](../design/MISHKAN_decisions.md).
178
+ - Initial harness commit: `35fa034`.