facult 2.8.8 → 2.8.11

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 CHANGED
@@ -31,7 +31,7 @@ It helps you:
31
31
  - render managed tool files into Codex, Claude, Cursor, and similar tools
32
32
  - inspect dependencies, provenance, and rendered outputs
33
33
  - review trust and audit remote or local capability before it spreads
34
- - capture writebacks and evolve canonical assets over time
34
+ - capture real-work friction as writeback and evolve canonical assets over time
35
35
 
36
36
  ## Quick Start
37
37
 
@@ -203,11 +203,18 @@ Useful AI behavior is composable. You need small reusable parts, a clean way to
203
203
  ## Built-in Defaults
204
204
 
205
205
  `fclt` includes a built-in layer for writeback and evolution. By default, that layer provides:
206
- - instructions for evolution, integration, and project capability
206
+ - instructions for learning/writeback, evolution, integration, and project capability
207
207
  - agents such as `writeback-curator`, `evolution-planner`, and `scope-promoter`
208
208
  - skills such as `capability-evolution` and `project-operating-layer-design`
209
209
 
210
- Those built-in defaults become live when you manage a tool. Global tool management renders the bundled docs, agents, and skills into that tools live files. Project-local `.ai` roots do not sync the built-in operating-model layer unless you explicitly enable it.
210
+ Those built-in defaults become live when you manage a tool. Global tool management renders the bundled docs, agents, and skills into that tool's live files, so every managed agent sees that it can preserve strong friction with `fclt ai writeback ...` and escalate repeated signal with `fclt ai evolve ...`. Project-local `.ai` roots do not sync the built-in operating-model layer unless you explicitly enable it.
211
+
212
+ The intended feedback loop is:
213
+ 1. agents notice durable friction, weak verification, stale guidance, or missing capability during normal work
214
+ 2. agents record one strong writeback when the signal, target, and scope are clear
215
+ 3. humans or scheduled automations review grouped writebacks and existing proposals
216
+ 4. only repeated evidence, a clearly missing capability, or a stale canonical asset becomes an evolution proposal
217
+ 5. accepted proposals update canonical markdown assets, skills, snippets, or project/global instructions
211
218
 
212
219
  If you want to disable default built-in sync for one canonical root:
213
220
 
@@ -224,8 +231,9 @@ Put that in `config.toml` or `config.local.toml` under the active canonical root
224
231
 
225
232
  `fclt` is CLI-first. The practical setup is:
226
233
  1. Install `fclt` globally so any agent runtime can execute it.
227
- 2. Put allowed `fclt` workflows in your agent instructions and skills.
228
- 3. Optionally scaffold MCP wrappers if you want an MCP entry that delegates to `fclt`.
234
+ 2. Manage each agent tool with `fclt manage <tool>` and `fclt sync`.
235
+ 3. Let the built-in operating-model layer render global writeback/evolution instructions into the tool.
236
+ 4. Optionally scaffold MCP wrappers if you want an MCP entry that delegates to `fclt`.
229
237
 
230
238
  ```bash
231
239
  # Scaffold reusable templates in the canonical store
@@ -250,6 +258,7 @@ fclt sync
250
258
  ```
251
259
 
252
260
  Note: `templates init mcp ...` is a scaffold, not a running server by itself.
261
+ The supported review surface today is the CLI plus generated Codex automation templates; MCP is an optional wrapper path when an agent environment prefers MCP calls over shell commands.
253
262
 
254
263
  ## Mental Model
255
264
 
@@ -455,9 +464,18 @@ Use writeback when:
455
464
  - an instruction or agent was missing key context
456
465
  - a pattern proved reusable enough to become doctrine
457
466
  - a project-local pattern deserves promotion toward global capability
467
+ - a skill, tool, prompt, or default behavior repeatedly slows agents down without hard-failing
458
468
 
459
469
  Do not think of writeback as note-taking. Treat it as preserved signal that should improve the system.
460
470
 
471
+ Recommended agent behavior:
472
+ - record a writeback directly when the learning is durable, scoped, and targetable
473
+ - prefer project scope for repo-specific tooling, tests, architecture, or workflow
474
+ - use global scope for shared doctrine, shared skills, shared agents, or cross-project capability gaps
475
+ - group or summarize before proposing evolution unless the missing capability is already obvious
476
+ - use the smallest proposal kind that fits: `update_asset`, `create_asset`, `extract_snippet`, `add_skill`, or `promote_asset`
477
+ - do not create proposals for one-off preferences, speculative ideas, or duplicate noise
478
+
461
479
  Current apply semantics are intentionally policy-bound:
462
480
  - targets are resolved through the generated graph when possible and fall back to canonical ref resolution for missing assets
463
481
  - apply is limited to markdown canonical assets
@@ -471,6 +489,14 @@ Current review/draft semantics:
471
489
  - rerunning `evolve draft <id> --append ...` revises the draft and records draft history
472
490
  - `evolve promote --to global` creates a new high-risk global proposal from a project-scoped proposal; that promoted proposal can then be drafted, reviewed, and applied into `~/.ai`
473
491
 
492
+ Review surfaces:
493
+ - `fclt status --json` reports queue/proposal paths and counts for the active scope
494
+ - `fclt ai writeback list|show|group|summarize` reviews raw and clustered signal
495
+ - `fclt ai evolve list|show|review` reviews proposal state without applying changes
496
+ - `fclt templates init automation learning-review` scaffolds background writeback capture/review
497
+ - `fclt templates init automation evolution-review` scaffolds periodic proposal review
498
+ - `fclt templates init automation tool-call-audit` scaffolds repeated tool-friction review
499
+
474
500
  ### Scope and source selection
475
501
 
476
502
  Most inventory and sync commands support explicit canonical-root selection:
@@ -614,6 +640,8 @@ Recommended topology:
614
640
  - Use a separate wide/global automation only for cross-repo or shared-surface review, such as global doctrine, shared skills, or repeated tool/agent patterns across repos.
615
641
  - If you do use a wide learning review, keep the `cwds` list intentionally small and related. The prompt is designed to partition by cwd first, not to blur unrelated repos together.
616
642
  - A practical default is daily `learning-review` plus weekly `evolution-review`. The first finds and records durable signal; the second keeps proposal review from stalling.
643
+ - Add `tool-call-audit` when you want a focused background loop for repeated tool failures, missing skills, excessive retries, or shallow-success patterns.
644
+ - Treat automations as review and synthesis loops. They should create writebacks and proposals when evidence is strong, but high-risk global changes still move through proposal review before apply.
617
645
 
618
646
  Files are written to:
619
647
 
@@ -799,7 +827,7 @@ Contributor and release workflow details live in [CONTRIBUTING.md](./CONTRIBUTIN
799
827
 
800
828
  Not as a first-party `fclt mcp serve` runtime.
801
829
 
802
- `fclt` currently focuses on inventory, trust/audit, install/update, and managed sync of canonical AI capability and tool-native outputs.
830
+ `fclt` currently focuses on inventory, trust/audit, install/update, writeback/evolution, and managed sync of canonical AI capability and tool-native outputs. Use the CLI directly from agents, or scaffold an MCP definition that delegates to the CLI when an environment needs an MCP-shaped entrypoint.
803
831
 
804
832
  ### Does fclt now manage global AI config, not just skills and MCP?
805
833
 
@@ -0,0 +1,20 @@
1
+ # Facult Operating Defaults
2
+
3
+ This machine has a default Facult operating-model layer available.
4
+
5
+ When work produces durable friction, weak verification, stale guidance, or a missing skill/tool capability, preserve that signal with `fclt ai writeback ...` when the target and scope are clear. When repeated writebacks or clearly missing capability point at a concrete improvement, use `fclt ai evolve ...` or the `capability-evolution` skill to make a reviewable proposal.
6
+
7
+ For writeback and evolution, read `@builtin/facult-operating-model/instructions/EVOLUTION.md`.
8
+ For learning and writeback defaults, read `@builtin/facult-operating-model/instructions/LEARNING_AND_WRITEBACK.md`.
9
+ For deciding whether capability belongs in global or project scope, read `@builtin/facult-operating-model/instructions/PROJECT_CAPABILITY.md`.
10
+ For project operating-layer design, read `@builtin/facult-operating-model/instructions/INTEGRATION.md`.
11
+
12
+ Builtin specialist agents are available for:
13
+ - writeback curation
14
+ - evolution planning
15
+ - scope promotion
16
+ - integration auditing
17
+
18
+ Builtin skills are available for:
19
+ - capability evolution
20
+ - project operating-layer design
@@ -0,0 +1,32 @@
1
+ name = "evolution-planner"
2
+ description = "Turn repeated writeback into concrete capability proposals."
3
+
4
+ developer_instructions = """
5
+ You plan capability evolution.
6
+
7
+ Prioritize:
8
+ - smallest useful change
9
+ - correct target asset type
10
+ - correct target scope
11
+ - evidence that justifies the change
12
+ - repeated writeback clusters or clearly missing capabilities, not isolated preferences
13
+
14
+ Proposal kinds you should consider first:
15
+ - update_asset
16
+ - create_asset
17
+ - extract_snippet
18
+ - add_skill
19
+ - promote_asset
20
+
21
+ Default to project scope when the pattern is repo-local.
22
+ Promote to global only when reuse is demonstrated and pollution risk is low.
23
+
24
+ Return concise proposals ordered by expected leverage, including:
25
+ - proposal kind
26
+ - target asset
27
+ - target scope
28
+ - why this is the smallest durable change
29
+
30
+ Do not escalate to evolution when a single writeback is enough.
31
+ Do not use evolution as a substitute for executable task tracking when the main need is owner, priority, state, or implementation follow-through.
32
+ """
@@ -0,0 +1,14 @@
1
+ name = "integration-auditor"
2
+ description = "Find where local success can still fail system-wide."
3
+
4
+ developer_instructions = """
5
+ You audit integration risk.
6
+
7
+ Prioritize:
8
+ - hidden dependencies
9
+ - rollout hazards
10
+ - operational constraints
11
+ - gaps between local verification and real system behavior
12
+
13
+ Return concise findings ordered by impact.
14
+ """
@@ -0,0 +1,18 @@
1
+ name = "scope-promoter"
2
+ description = "Decide whether learning belongs at project or global scope."
3
+
4
+ developer_instructions = """
5
+ You decide scope.
6
+
7
+ Prioritize:
8
+ - project specificity
9
+ - cross-project reuse potential
10
+ - pollution risk from globalizing too early
11
+
12
+ When recommending promotion, make the standard path explicit:
13
+ - keep the source capability in project scope until promotion is approved
14
+ - create a reviewable global proposal
15
+ - do not treat promotion as implicit apply
16
+
17
+ Return concise decisions with rationale.
18
+ """
@@ -0,0 +1,24 @@
1
+ name = "writeback-curator"
2
+ description = "Turn noisy outcomes into high-signal writeback."
3
+
4
+ developer_instructions = """
5
+ You curate durable writeback.
6
+
7
+ Prioritize:
8
+ - repeated failures
9
+ - repeated wins
10
+ - stale guidance
11
+ - missing capability edges
12
+ - tool, skill, MCP, plugin, automation, or instruction friction that repeatedly slows work down
13
+
14
+ For each recommendation, prefer returning:
15
+ - suggested writeback kind
16
+ - best target asset or destination
17
+ - best scope (`project` or `global`)
18
+ - the evidence that justifies recording it
19
+
20
+ Do not emit low-signal noise.
21
+ If the learning is repo-specific, keep it project-scoped by default.
22
+ When the signal is already strong and the target is clear, prefer recommending direct writeback capture rather than abstract advice.
23
+ When the issue is executable tooling work, recommend task tracking for the fix and writeback only for the reusable operating-model learning.
24
+ """
@@ -0,0 +1,130 @@
1
+ ---
2
+ description: Turn repeated signal into concrete capability changes.
3
+ tags: [facult, evolution, writeback]
4
+ ---
5
+
6
+ # Evolution
7
+
8
+ Use writeback and evolution to improve the AI operating layer itself.
9
+
10
+ Evolution is the synthesis and change side of the feedback loop. It turns accumulated writebacks, repeated tool friction, stale canonical assets, or clearly missing capability into small reviewable changes to instructions, skills, snippets, agents, or other markdown canonical assets.
11
+
12
+ ## When To Record Writeback
13
+
14
+ Record writeback when one of these is true:
15
+
16
+ - the same failure repeats
17
+ - the same success pattern repeats
18
+ - guidance is stale or missing
19
+ - a prompt or loop has to be restated often
20
+ - a project-specific pattern looks reusable
21
+
22
+ Do not record low-signal noise:
23
+
24
+ - one-off annoyance with no reuse value
25
+ - generic "could be better" commentary
26
+ - duplicate observations with no new evidence
27
+
28
+ The intended default is that agents record strong writebacks themselves when the signal is clear enough, rather than only recommending that a user do it manually later.
29
+
30
+ Do not wait for a weekly review to preserve high-signal evidence. Do wait for repeated evidence or a clearly missing capability before drafting a proposal.
31
+
32
+ ## Scope
33
+
34
+ Choose `project` scope when the learning depends on:
35
+
36
+ - repo architecture
37
+ - team workflow
38
+ - project tooling
39
+ - local testing or verification behavior
40
+
41
+ Choose `global` scope when the learning is reusable across projects.
42
+
43
+ Promote from project to global only after repeated reuse or strong evidence.
44
+
45
+ ## Writeback Kinds
46
+
47
+ Common kinds:
48
+
49
+ - `weak_verification`
50
+ - `false_positive`
51
+ - `missing_context`
52
+ - `reusable_pattern`
53
+ - `capability_gap`
54
+ - `bad_default`
55
+
56
+ Every good writeback should try to include:
57
+
58
+ - a concrete summary
59
+ - the best target asset if known
60
+ - the right scope
61
+ - domain or tags when useful
62
+
63
+ ## Operator Flow
64
+
65
+ Typical workflow:
66
+
67
+ ```bash
68
+ fclt ai writeback add --kind weak_verification --summary "Checks were too shallow" --asset instruction:VERIFICATION
69
+ fclt ai writeback group --by asset
70
+ fclt ai writeback summarize --by domain
71
+ fclt ai evolve propose
72
+ fclt ai evolve draft EV-00001
73
+ fclt ai evolve accept EV-00001
74
+ fclt ai evolve apply EV-00001
75
+ ```
76
+
77
+ Use `fclt ai evolve draft <id> --append "..."` to revise a draft while preserving draft history.
78
+
79
+ Review surfaces:
80
+
81
+ - `fclt status --json` for queue/proposal paths, counts, and active scope
82
+ - `fclt ai writeback list|show|group|summarize` for raw and clustered signal
83
+ - `fclt ai evolve list|show|review` for proposal state without applying changes
84
+ - `fclt templates init automation learning-review` for recurring capture/review
85
+ - `fclt templates init automation evolution-review` for recurring proposal review
86
+ - `fclt templates init automation tool-call-audit` for repeated tool-friction review
87
+
88
+ Evolution proposal metadata, markdown drafts, patch artifacts, writeback queues,
89
+ and journals are runtime state. `fclt` stores them in machine-local Facult state;
90
+ canonical assets in `~/.ai` or `<repo>/.ai` should only change when a proposal is
91
+ applied.
92
+
93
+ ## Default Agent Behavior
94
+
95
+ Use the smallest action that fits the signal:
96
+
97
+ 1. record one strong writeback when there is a clear durable learning
98
+ 2. use `writeback-curator` when the target, kind, or scope is ambiguous
99
+ 3. use `capability-evolution` or `evolution-planner` when repeated signal should become a proposal
100
+ 4. do not draft or apply proposals just because a writeback exists; require repeated evidence or a clearly missing capability
101
+
102
+ Avoid creating writeback/evolution noise for one-off nits, vague preferences, or speculative ideas without evidence.
103
+
104
+ When the friction is executable product/tooling work that needs ownership,
105
+ priority, state, or implementation follow-through, create or update a real task
106
+ system item instead of forcing it into capability evolution. Use evolution for
107
+ the reusable operating-layer change.
108
+
109
+ ## Proposal Kinds
110
+
111
+ Current supported proposal kinds:
112
+
113
+ - `update_asset`
114
+ - `create_asset`
115
+ - `extract_snippet`
116
+ - `add_skill`
117
+ - `promote_asset`
118
+
119
+ Use the smallest durable change that fits the evidence.
120
+
121
+ ## Review And Apply Rules
122
+
123
+ - draft before apply
124
+ - accept before apply
125
+ - prefer the smallest safe change
126
+ - keep reviewable evidence tied to source writebacks
127
+ - do not globalize project behavior too early
128
+ - do not apply high-risk global instruction, skill, plugin, or non-COS changes without explicit review/approval
129
+
130
+ Apply is for markdown canonical assets only. If the target is wrong, revise the proposal rather than forcing it through.
@@ -0,0 +1,8 @@
1
+ ---
2
+ description: Detect where local success can still fail at integration boundaries.
3
+ tags: [facult, integration, verification]
4
+ ---
5
+
6
+ # Integration
7
+
8
+ Distinguish local correctness from system correctness. Check hidden dependencies, rollout order, and operational constraints before calling work done.
@@ -0,0 +1,63 @@
1
+ ---
2
+ description: Preserve durable signal and record writeback when the operating layer should learn.
3
+ tags: [facult, learning, writeback]
4
+ ---
5
+
6
+ # Learning And Writeback
7
+
8
+ Use this when work produces a durable decision, failure, success pattern, or missing guardrail that should outlive the current task.
9
+
10
+ This is the capture side of the feedback loop. The goal is to let normal agent work produce reusable signal without requiring a human to manually restate every friction point later.
11
+
12
+ ## Default Behavior
13
+
14
+ The normal path should be agent-driven.
15
+
16
+ If you can clearly answer:
17
+
18
+ - what was learned
19
+ - why it matters
20
+ - where it should land
21
+ - whether it belongs in `project` or `global`
22
+
23
+ then record the writeback instead of only suggesting that someone should do it later.
24
+
25
+ Use:
26
+
27
+ ```bash
28
+ fclt ai writeback add --kind <kind> --summary "<summary>" --asset <asset-selector>
29
+ ```
30
+
31
+ The writeback queue is runtime state, not canonical source. `fclt` stores it in
32
+ machine-local Facult state so sandboxed agents can record durable friction
33
+ without mutating `~/.ai` or a repo-local `.ai` unless an evolution proposal is
34
+ later reviewed and applied.
35
+
36
+ Project-scoped writebacks should usually be recorded from the repo that produced
37
+ the evidence. Global writebacks should be reserved for shared doctrine, shared
38
+ skills, shared agents, tool behavior, or cross-project capability gaps.
39
+
40
+ ## Record Writeback When
41
+
42
+ - the same failure or weak loop appears again
43
+ - a reusable success pattern shows up
44
+ - guidance is clearly stale or missing
45
+ - a repo-local behavior probably belongs in project capability
46
+ - a cross-project behavior probably belongs in global capability
47
+ - a skill, tool, MCP, plugin, automation, or instruction gap repeatedly slows work down
48
+ - an agent has to restate the same workaround, verification rule, or review rule
49
+
50
+ ## Do Not Record Writeback For
51
+
52
+ - one-off annoyance with no durable value
53
+ - weak commentary with no target
54
+ - speculative ideas without evidence
55
+ - duplicate noise with no new signal
56
+
57
+ ## Follow Through
58
+
59
+ - prefer one strong writeback over many weak ones
60
+ - mention the writeback id when summarizing what changed
61
+ - escalate to `capability-evolution` or `fclt ai evolve ...` only when the signal is repeated or clearly points at a durable capability change
62
+ - use `fclt ai writeback group --by asset` or `fclt ai writeback summarize --by domain` to review accumulated signal before proposing broad changes
63
+ - use scheduled `learning-review`, `evolution-review`, or `tool-call-audit` automations when the signal should be reviewed in the background
@@ -0,0 +1,33 @@
1
+ ---
2
+ description: Decide what belongs in repo-local .ai versus the global store.
3
+ tags: [facult, project, scope]
4
+ ---
5
+
6
+ # Project Capability
7
+
8
+ Prefer project scope when the guidance depends on repo architecture, team workflow, or colocated tooling. Promote to global only after repeated cross-project reuse.
9
+
10
+ ## Project First
11
+
12
+ Default to `<repo>/.ai` when the capability is about:
13
+
14
+ - local architecture
15
+ - repo-specific testing or verification
16
+ - team conventions
17
+ - project tools and workflows
18
+
19
+ ## Promote Carefully
20
+
21
+ Promote to `~/.ai` only when:
22
+
23
+ - the same pattern succeeds in more than one repo
24
+ - the capability is not coupled to local architecture
25
+ - the global version will not create noise for unrelated projects
26
+
27
+ Use:
28
+
29
+ ```bash
30
+ fclt ai evolve promote EV-00001 --to global --project
31
+ ```
32
+
33
+ That creates a new global proposal for review. It does not auto-apply the promotion.
@@ -0,0 +1,70 @@
1
+ ---
2
+ description: Convert repeated writeback into concrete fclt capability proposals.
3
+ tags: [facult, evolution, writeback]
4
+ ---
5
+
6
+ # capability-evolution
7
+
8
+ ## When To Use
9
+ Use this skill when the same missing guidance, weak loop, or recurring win appears often enough that the AI system itself should probably change.
10
+
11
+ Do not wait for a human operator by default if the signal is already clear and the environment permits local AI runtime state to be updated.
12
+
13
+ Use writeback first when the signal is useful but not yet repeated. Use evolution when accumulated writebacks, repeated tool friction, or a clearly missing capability point at a specific target asset or new capability.
14
+
15
+ ## Scope Decision
16
+
17
+ Choose `project` when the behavior depends on repo-local architecture or workflow.
18
+
19
+ Choose `global` when the behavior is broadly reusable.
20
+
21
+ If unsure, start at project scope and promote later with evidence.
22
+
23
+ ## Working Flow
24
+
25
+ 1. record the strongest writeback
26
+ 2. group or summarize repeated signal
27
+ 3. choose the smallest valid proposal kind
28
+ 4. draft the proposal
29
+ 5. accept only after the target and scope are correct
30
+ 6. apply only when the markdown target is the intended canonical asset
31
+
32
+ Use:
33
+
34
+ ```bash
35
+ fclt ai writeback add ...
36
+ fclt ai writeback group --by asset
37
+ fclt ai writeback summarize --by domain
38
+ fclt ai evolve propose
39
+ fclt ai evolve draft EV-00001
40
+ fclt ai evolve draft EV-00001 --append "tighten the rule with a concrete verification step"
41
+ fclt ai evolve accept EV-00001
42
+ fclt ai evolve apply EV-00001
43
+ ```
44
+
45
+ For background review loops, use:
46
+
47
+ ```bash
48
+ fclt templates init automation learning-review
49
+ fclt templates init automation evolution-review
50
+ fclt templates init automation tool-call-audit
51
+ ```
52
+
53
+ If there is not yet enough repeated signal for evolution, record the writeback and stop there.
54
+
55
+ ## Proposal Kind Selection
56
+
57
+ - `update_asset` for tightening existing guidance
58
+ - `create_asset` for missing instructions or docs
59
+ - `extract_snippet` for reusable partial guidance
60
+ - `add_skill` for reusable workflow instruction
61
+ - `promote_asset` for project-to-global promotion
62
+
63
+ Use task tracking instead of evolution when the main work is an executable tool or product fix that needs an owner, priority, state, or delivery plan. Use evolution for the reusable instruction, skill, or operating-model change that should survive that fix.
64
+
65
+ ## Output Contract
66
+ - repeated signal
67
+ - proposed asset change
68
+ - target scope
69
+ - evidence
70
+ - smallest useful next step
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: Design or improve a repo-local .ai operating layer.
3
+ tags: [facult, project, design]
4
+ ---
5
+
6
+ # project-operating-layer-design
7
+
8
+ ## When To Use
9
+ Use this skill when a project needs its own `.ai/` structure, repo-specific instructions, or local bootstrap guidance.
10
+
11
+ ## Output Contract
12
+ - recommended `.ai/` layout
13
+ - what stays project-local
14
+ - what stays global
15
+ - what should remain generated runtime output only
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "facult",
3
- "version": "2.8.8",
3
+ "version": "2.8.11",
4
4
  "description": "Manage canonical AI capabilities, sync surfaces, and evolution state.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -27,6 +27,8 @@
27
27
  "access": "public"
28
28
  },
29
29
  "files": [
30
+ "assets/**/*.md",
31
+ "assets/**/*.toml",
30
32
  "bin/fclt.cjs",
31
33
  "bin/facult.cjs",
32
34
  "src/**/*.ts",
@@ -0,0 +1,5 @@
1
+ // Generated by scripts/generate-builtin-assets.ts. Do not edit by hand.
2
+
3
+ export const BUILTIN_OPERATING_MODEL_FILES = JSON.parse(
4
+ '{"AGENTS.global.md":"# Facult Operating Defaults\\n\\nThis machine has a default Facult operating-model layer available.\\n\\nWhen work produces durable friction, weak verification, stale guidance, or a missing skill/tool capability, preserve that signal with `fclt ai writeback ...` when the target and scope are clear. When repeated writebacks or clearly missing capability point at a concrete improvement, use `fclt ai evolve ...` or the `capability-evolution` skill to make a reviewable proposal.\\n\\nFor writeback and evolution, read `@builtin/facult-operating-model/instructions/EVOLUTION.md`.\\nFor learning and writeback defaults, read `@builtin/facult-operating-model/instructions/LEARNING_AND_WRITEBACK.md`.\\nFor deciding whether capability belongs in global or project scope, read `@builtin/facult-operating-model/instructions/PROJECT_CAPABILITY.md`.\\nFor project operating-layer design, read `@builtin/facult-operating-model/instructions/INTEGRATION.md`.\\n\\nBuiltin specialist agents are available for:\\n- writeback curation\\n- evolution planning\\n- scope promotion\\n- integration auditing\\n\\nBuiltin skills are available for:\\n- capability evolution\\n- project operating-layer design\\n","agents/evolution-planner/agent.toml":"name = \\"evolution-planner\\"\\ndescription = \\"Turn repeated writeback into concrete capability proposals.\\"\\n\\ndeveloper_instructions = \\"\\"\\"\\nYou plan capability evolution.\\n\\nPrioritize:\\n- smallest useful change\\n- correct target asset type\\n- correct target scope\\n- evidence that justifies the change\\n- repeated writeback clusters or clearly missing capabilities, not isolated preferences\\n\\nProposal kinds you should consider first:\\n- update_asset\\n- create_asset\\n- extract_snippet\\n- add_skill\\n- promote_asset\\n\\nDefault to project scope when the pattern is repo-local.\\nPromote to global only when reuse is demonstrated and pollution risk is low.\\n\\nReturn concise proposals ordered by expected leverage, including:\\n- proposal kind\\n- target asset\\n- target scope\\n- why this is the smallest durable change\\n\\nDo not escalate to evolution when a single writeback is enough.\\nDo not use evolution as a substitute for executable task tracking when the main need is owner, priority, state, or implementation follow-through.\\n\\"\\"\\"\\n","agents/integration-auditor/agent.toml":"name = \\"integration-auditor\\"\\ndescription = \\"Find where local success can still fail system-wide.\\"\\n\\ndeveloper_instructions = \\"\\"\\"\\nYou audit integration risk.\\n\\nPrioritize:\\n- hidden dependencies\\n- rollout hazards\\n- operational constraints\\n- gaps between local verification and real system behavior\\n\\nReturn concise findings ordered by impact.\\n\\"\\"\\"\\n","agents/scope-promoter/agent.toml":"name = \\"scope-promoter\\"\\ndescription = \\"Decide whether learning belongs at project or global scope.\\"\\n\\ndeveloper_instructions = \\"\\"\\"\\nYou decide scope.\\n\\nPrioritize:\\n- project specificity\\n- cross-project reuse potential\\n- pollution risk from globalizing too early\\n\\nWhen recommending promotion, make the standard path explicit:\\n- keep the source capability in project scope until promotion is approved\\n- create a reviewable global proposal\\n- do not treat promotion as implicit apply\\n\\nReturn concise decisions with rationale.\\n\\"\\"\\"\\n","agents/writeback-curator/agent.toml":"name = \\"writeback-curator\\"\\ndescription = \\"Turn noisy outcomes into high-signal writeback.\\"\\n\\ndeveloper_instructions = \\"\\"\\"\\nYou curate durable writeback.\\n\\nPrioritize:\\n- repeated failures\\n- repeated wins\\n- stale guidance\\n- missing capability edges\\n- tool, skill, MCP, plugin, automation, or instruction friction that repeatedly slows work down\\n\\nFor each recommendation, prefer returning:\\n- suggested writeback kind\\n- best target asset or destination\\n- best scope (`project` or `global`)\\n- the evidence that justifies recording it\\n\\nDo not emit low-signal noise.\\nIf the learning is repo-specific, keep it project-scoped by default.\\nWhen the signal is already strong and the target is clear, prefer recommending direct writeback capture rather than abstract advice.\\nWhen the issue is executable tooling work, recommend task tracking for the fix and writeback only for the reusable operating-model learning.\\n\\"\\"\\"\\n","instructions/EVOLUTION.md":"---\\ndescription: Turn repeated signal into concrete capability changes.\\ntags: [facult, evolution, writeback]\\n---\\n\\n# Evolution\\n\\nUse writeback and evolution to improve the AI operating layer itself.\\n\\nEvolution is the synthesis and change side of the feedback loop. It turns accumulated writebacks, repeated tool friction, stale canonical assets, or clearly missing capability into small reviewable changes to instructions, skills, snippets, agents, or other markdown canonical assets.\\n\\n## When To Record Writeback\\n\\nRecord writeback when one of these is true:\\n\\n- the same failure repeats\\n- the same success pattern repeats\\n- guidance is stale or missing\\n- a prompt or loop has to be restated often\\n- a project-specific pattern looks reusable\\n\\nDo not record low-signal noise:\\n\\n- one-off annoyance with no reuse value\\n- generic \\"could be better\\" commentary\\n- duplicate observations with no new evidence\\n\\nThe intended default is that agents record strong writebacks themselves when the signal is clear enough, rather than only recommending that a user do it manually later.\\n\\nDo not wait for a weekly review to preserve high-signal evidence. Do wait for repeated evidence or a clearly missing capability before drafting a proposal.\\n\\n## Scope\\n\\nChoose `project` scope when the learning depends on:\\n\\n- repo architecture\\n- team workflow\\n- project tooling\\n- local testing or verification behavior\\n\\nChoose `global` scope when the learning is reusable across projects.\\n\\nPromote from project to global only after repeated reuse or strong evidence.\\n\\n## Writeback Kinds\\n\\nCommon kinds:\\n\\n- `weak_verification`\\n- `false_positive`\\n- `missing_context`\\n- `reusable_pattern`\\n- `capability_gap`\\n- `bad_default`\\n\\nEvery good writeback should try to include:\\n\\n- a concrete summary\\n- the best target asset if known\\n- the right scope\\n- domain or tags when useful\\n\\n## Operator Flow\\n\\nTypical workflow:\\n\\n```bash\\nfclt ai writeback add --kind weak_verification --summary \\"Checks were too shallow\\" --asset instruction:VERIFICATION\\nfclt ai writeback group --by asset\\nfclt ai writeback summarize --by domain\\nfclt ai evolve propose\\nfclt ai evolve draft EV-00001\\nfclt ai evolve accept EV-00001\\nfclt ai evolve apply EV-00001\\n```\\n\\nUse `fclt ai evolve draft <id> --append \\"...\\"` to revise a draft while preserving draft history.\\n\\nReview surfaces:\\n\\n- `fclt status --json` for queue/proposal paths, counts, and active scope\\n- `fclt ai writeback list|show|group|summarize` for raw and clustered signal\\n- `fclt ai evolve list|show|review` for proposal state without applying changes\\n- `fclt templates init automation learning-review` for recurring capture/review\\n- `fclt templates init automation evolution-review` for recurring proposal review\\n- `fclt templates init automation tool-call-audit` for repeated tool-friction review\\n\\nEvolution proposal metadata, markdown drafts, patch artifacts, writeback queues,\\nand journals are runtime state. `fclt` stores them in machine-local Facult state;\\ncanonical assets in `~/.ai` or `<repo>/.ai` should only change when a proposal is\\napplied.\\n\\n## Default Agent Behavior\\n\\nUse the smallest action that fits the signal:\\n\\n1. record one strong writeback when there is a clear durable learning\\n2. use `writeback-curator` when the target, kind, or scope is ambiguous\\n3. use `capability-evolution` or `evolution-planner` when repeated signal should become a proposal\\n4. do not draft or apply proposals just because a writeback exists; require repeated evidence or a clearly missing capability\\n\\nAvoid creating writeback/evolution noise for one-off nits, vague preferences, or speculative ideas without evidence.\\n\\nWhen the friction is executable product/tooling work that needs ownership,\\npriority, state, or implementation follow-through, create or update a real task\\nsystem item instead of forcing it into capability evolution. Use evolution for\\nthe reusable operating-layer change.\\n\\n## Proposal Kinds\\n\\nCurrent supported proposal kinds:\\n\\n- `update_asset`\\n- `create_asset`\\n- `extract_snippet`\\n- `add_skill`\\n- `promote_asset`\\n\\nUse the smallest durable change that fits the evidence.\\n\\n## Review And Apply Rules\\n\\n- draft before apply\\n- accept before apply\\n- prefer the smallest safe change\\n- keep reviewable evidence tied to source writebacks\\n- do not globalize project behavior too early\\n- do not apply high-risk global instruction, skill, plugin, or non-COS changes without explicit review/approval\\n\\nApply is for markdown canonical assets only. If the target is wrong, revise the proposal rather than forcing it through.\\n","instructions/INTEGRATION.md":"---\\ndescription: Detect where local success can still fail at integration boundaries.\\ntags: [facult, integration, verification]\\n---\\n\\n# Integration\\n\\nDistinguish local correctness from system correctness. Check hidden dependencies, rollout order, and operational constraints before calling work done.\\n","instructions/LEARNING_AND_WRITEBACK.md":"---\\ndescription: Preserve durable signal and record writeback when the operating layer should learn.\\ntags: [facult, learning, writeback]\\n---\\n\\n# Learning And Writeback\\n\\nUse this when work produces a durable decision, failure, success pattern, or missing guardrail that should outlive the current task.\\n\\nThis is the capture side of the feedback loop. The goal is to let normal agent work produce reusable signal without requiring a human to manually restate every friction point later.\\n\\n## Default Behavior\\n\\nThe normal path should be agent-driven.\\n\\nIf you can clearly answer:\\n\\n- what was learned\\n- why it matters\\n- where it should land\\n- whether it belongs in `project` or `global`\\n\\nthen record the writeback instead of only suggesting that someone should do it later.\\n\\nUse:\\n\\n```bash\\nfclt ai writeback add --kind <kind> --summary \\"<summary>\\" --asset <asset-selector>\\n```\\n\\nThe writeback queue is runtime state, not canonical source. `fclt` stores it in\\nmachine-local Facult state so sandboxed agents can record durable friction\\nwithout mutating `~/.ai` or a repo-local `.ai` unless an evolution proposal is\\nlater reviewed and applied.\\n\\nProject-scoped writebacks should usually be recorded from the repo that produced\\nthe evidence. Global writebacks should be reserved for shared doctrine, shared\\nskills, shared agents, tool behavior, or cross-project capability gaps.\\n\\n## Record Writeback When\\n\\n- the same failure or weak loop appears again\\n- a reusable success pattern shows up\\n- guidance is clearly stale or missing\\n- a repo-local behavior probably belongs in project capability\\n- a cross-project behavior probably belongs in global capability\\n- a skill, tool, MCP, plugin, automation, or instruction gap repeatedly slows work down\\n- an agent has to restate the same workaround, verification rule, or review rule\\n\\n## Do Not Record Writeback For\\n\\n- one-off annoyance with no durable value\\n- weak commentary with no target\\n- speculative ideas without evidence\\n- duplicate noise with no new signal\\n\\n## Follow Through\\n\\n- prefer one strong writeback over many weak ones\\n- mention the writeback id when summarizing what changed\\n- escalate to `capability-evolution` or `fclt ai evolve ...` only when the signal is repeated or clearly points at a durable capability change\\n- use `fclt ai writeback group --by asset` or `fclt ai writeback summarize --by domain` to review accumulated signal before proposing broad changes\\n- use scheduled `learning-review`, `evolution-review`, or `tool-call-audit` automations when the signal should be reviewed in the background\\n","instructions/PROJECT_CAPABILITY.md":"---\\ndescription: Decide what belongs in repo-local .ai versus the global store.\\ntags: [facult, project, scope]\\n---\\n\\n# Project Capability\\n\\nPrefer project scope when the guidance depends on repo architecture, team workflow, or colocated tooling. Promote to global only after repeated cross-project reuse.\\n\\n## Project First\\n\\nDefault to `<repo>/.ai` when the capability is about:\\n\\n- local architecture\\n- repo-specific testing or verification\\n- team conventions\\n- project tools and workflows\\n\\n## Promote Carefully\\n\\nPromote to `~/.ai` only when:\\n\\n- the same pattern succeeds in more than one repo\\n- the capability is not coupled to local architecture\\n- the global version will not create noise for unrelated projects\\n\\nUse:\\n\\n```bash\\nfclt ai evolve promote EV-00001 --to global --project\\n```\\n\\nThat creates a new global proposal for review. It does not auto-apply the promotion.\\n","skills/capability-evolution/SKILL.md":"---\\ndescription: Convert repeated writeback into concrete fclt capability proposals.\\ntags: [facult, evolution, writeback]\\n---\\n\\n# capability-evolution\\n\\n## When To Use\\nUse this skill when the same missing guidance, weak loop, or recurring win appears often enough that the AI system itself should probably change.\\n\\nDo not wait for a human operator by default if the signal is already clear and the environment permits local AI runtime state to be updated.\\n\\nUse writeback first when the signal is useful but not yet repeated. Use evolution when accumulated writebacks, repeated tool friction, or a clearly missing capability point at a specific target asset or new capability.\\n\\n## Scope Decision\\n\\nChoose `project` when the behavior depends on repo-local architecture or workflow.\\n\\nChoose `global` when the behavior is broadly reusable.\\n\\nIf unsure, start at project scope and promote later with evidence.\\n\\n## Working Flow\\n\\n1. record the strongest writeback\\n2. group or summarize repeated signal\\n3. choose the smallest valid proposal kind\\n4. draft the proposal\\n5. accept only after the target and scope are correct\\n6. apply only when the markdown target is the intended canonical asset\\n\\nUse:\\n\\n```bash\\nfclt ai writeback add ...\\nfclt ai writeback group --by asset\\nfclt ai writeback summarize --by domain\\nfclt ai evolve propose\\nfclt ai evolve draft EV-00001\\nfclt ai evolve draft EV-00001 --append \\"tighten the rule with a concrete verification step\\"\\nfclt ai evolve accept EV-00001\\nfclt ai evolve apply EV-00001\\n```\\n\\nFor background review loops, use:\\n\\n```bash\\nfclt templates init automation learning-review\\nfclt templates init automation evolution-review\\nfclt templates init automation tool-call-audit\\n```\\n\\nIf there is not yet enough repeated signal for evolution, record the writeback and stop there.\\n\\n## Proposal Kind Selection\\n\\n- `update_asset` for tightening existing guidance\\n- `create_asset` for missing instructions or docs\\n- `extract_snippet` for reusable partial guidance\\n- `add_skill` for reusable workflow instruction\\n- `promote_asset` for project-to-global promotion\\n\\nUse task tracking instead of evolution when the main work is an executable tool or product fix that needs an owner, priority, state, or delivery plan. Use evolution for the reusable instruction, skill, or operating-model change that should survive that fix.\\n\\n## Output Contract\\n- repeated signal\\n- proposed asset change\\n- target scope\\n- evidence\\n- smallest useful next step\\n","skills/project-operating-layer-design/SKILL.md":"---\\ndescription: Design or improve a repo-local .ai operating layer.\\ntags: [facult, project, design]\\n---\\n\\n# project-operating-layer-design\\n\\n## When To Use\\nUse this skill when a project needs its own `.ai/` structure, repo-specific instructions, or local bootstrap guidance.\\n\\n## Output Contract\\n- recommended `.ai/` layout\\n- what stays project-local\\n- what stays global\\n- what should remain generated runtime output only\\n"}'
5
+ ) as Record<string, string>;
package/src/builtin.ts CHANGED
@@ -1,5 +1,8 @@
1
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
+ import { tmpdir } from "node:os";
1
3
  import { dirname, join } from "node:path";
2
4
  import { fileURLToPath } from "node:url";
5
+ import { BUILTIN_OPERATING_MODEL_FILES } from "./builtin-assets";
3
6
  import { projectRootFromAiRoot } from "./paths";
4
7
 
5
8
  function isPlainObject(value: unknown): value is Record<string, unknown> {
@@ -10,7 +13,35 @@ export function facultBuiltinPackRoot(
10
13
  packName = "facult-operating-model"
11
14
  ): string {
12
15
  const here = dirname(fileURLToPath(import.meta.url));
13
- return join(here, "..", "assets", "packs", packName);
16
+ const sourceRoot = join(here, "..", "assets", "packs", packName);
17
+ if (existsSync(sourceRoot)) {
18
+ return sourceRoot;
19
+ }
20
+ if (packName === "facult-operating-model") {
21
+ return materializeBuiltinOperatingModelPack();
22
+ }
23
+ return sourceRoot;
24
+ }
25
+
26
+ function materializeBuiltinOperatingModelPack(): string {
27
+ const root = join(tmpdir(), "fclt-builtin-packs", "facult-operating-model");
28
+ for (const [relativePath, content] of Object.entries(
29
+ BUILTIN_OPERATING_MODEL_FILES
30
+ )) {
31
+ const pathValue = join(root, relativePath);
32
+ mkdirSync(dirname(pathValue), { recursive: true });
33
+ if (existsSync(pathValue)) {
34
+ try {
35
+ if (readFileSync(pathValue, "utf8") === content) {
36
+ continue;
37
+ }
38
+ } catch {
39
+ // Rewrite unreadable materialized assets below.
40
+ }
41
+ }
42
+ writeFileSync(pathValue, content, "utf8");
43
+ }
44
+ return root;
14
45
  }
15
46
 
16
47
  async function readTomlObject(
@@ -1,7 +1,7 @@
1
1
  import { mkdir, readdir } from "node:fs/promises";
2
2
  import { basename, dirname, isAbsolute, join, relative } from "node:path";
3
- import { fileURLToPath } from "node:url";
4
3
  import { getAdapter } from "./adapters";
4
+ import { facultBuiltinPackRoot } from "./builtin";
5
5
  import { parseCliContextArgs, resolveCliContextRoot } from "./cli-context";
6
6
  import {
7
7
  type AssetScope,
@@ -524,11 +524,6 @@ async function readJsonSafe(p: string): Promise<unknown> {
524
524
  return JSON.parse(txt);
525
525
  }
526
526
 
527
- function builtinAssetsRoot(): string {
528
- const here = dirname(fileURLToPath(import.meta.url));
529
- return join(here, "..", "assets", "packs", "facult-operating-model");
530
- }
531
-
532
527
  function canonicalRefForPath(
533
528
  source: IndexedSource,
534
529
  category:
@@ -1628,7 +1623,7 @@ export async function buildIndex(opts?: {
1628
1623
 
1629
1624
  const globalRoot = facultRootDir(homeDir);
1630
1625
  const sources: IndexedSource[] = [];
1631
- const builtinRoot = builtinAssetsRoot();
1626
+ const builtinRoot = facultBuiltinPackRoot();
1632
1627
  try {
1633
1628
  const st = await Bun.file(builtinRoot).stat();
1634
1629
  if (st.isDirectory()) {