instar 0.23.18 → 0.24.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 (46) hide show
  1. package/.claude/hooks/auto-approve-claude-edits.py +72 -0
  2. package/.claude/settings.json +65 -1
  3. package/dist/cli.js +0 -0
  4. package/dist/commands/init.d.ts.map +1 -1
  5. package/dist/commands/init.js +769 -310
  6. package/dist/commands/init.js.map +1 -1
  7. package/dist/core/Config.d.ts.map +1 -1
  8. package/dist/core/Config.js +5 -3
  9. package/dist/core/Config.js.map +1 -1
  10. package/dist/core/ResponseReviewGate.d.ts +182 -0
  11. package/dist/core/ResponseReviewGate.d.ts.map +1 -0
  12. package/dist/core/ResponseReviewGate.js +956 -0
  13. package/dist/core/ResponseReviewGate.js.map +1 -0
  14. package/dist/core/SessionManager.d.ts.map +1 -1
  15. package/dist/core/SessionManager.js +6 -0
  16. package/dist/core/SessionManager.js.map +1 -1
  17. package/dist/core/types.d.ts +5 -0
  18. package/dist/core/types.d.ts.map +1 -1
  19. package/dist/core/types.js.map +1 -1
  20. package/dist/monitoring/HomeostasisMonitor.d.ts +102 -0
  21. package/dist/monitoring/HomeostasisMonitor.d.ts.map +1 -0
  22. package/dist/monitoring/HomeostasisMonitor.js +185 -0
  23. package/dist/monitoring/HomeostasisMonitor.js.map +1 -0
  24. package/dist/monitoring/QuotaManager.d.ts +5 -0
  25. package/dist/monitoring/QuotaManager.d.ts.map +1 -1
  26. package/dist/monitoring/QuotaManager.js +23 -4
  27. package/dist/monitoring/QuotaManager.js.map +1 -1
  28. package/dist/monitoring/QuotaNotifier.js +4 -4
  29. package/dist/monitoring/QuotaNotifier.js.map +1 -1
  30. package/dist/monitoring/QuotaTracker.d.ts +3 -3
  31. package/dist/monitoring/QuotaTracker.js +3 -3
  32. package/dist/scaffold/templates.d.ts.map +1 -1
  33. package/dist/scaffold/templates.js +22 -0
  34. package/dist/scaffold/templates.js.map +1 -1
  35. package/dist/scheduler/JobScheduler.d.ts.map +1 -1
  36. package/dist/scheduler/JobScheduler.js +2 -1
  37. package/dist/scheduler/JobScheduler.js.map +1 -1
  38. package/dist/server/routes.d.ts.map +1 -1
  39. package/dist/server/routes.js +42 -0
  40. package/dist/server/routes.js.map +1 -1
  41. package/package.json +2 -2
  42. package/src/data/builtin-manifest.json +142 -102
  43. package/src/templates/hooks/session-start.sh +5 -0
  44. package/upgrades/0.23.18.md +31 -3
  45. package/upgrades/0.24.0.md +41 -0
  46. package/upgrades/NEXT.md +35 -0
@@ -1769,6 +1769,583 @@ Reflection is not performance. Don't write what sounds good — write what is tr
1769
1769
  The goal is not to fill every section. Empty sections are honest. Forced content is noise.
1770
1770
 
1771
1771
  Your identity is not static. It is earned through work, refined through reflection, and authored by you.
1772
+ `,
1773
+ },
1774
+ 'coherence-audit': {
1775
+ name: 'coherence-audit',
1776
+ description: 'Verify topic-project bindings, project map freshness, canonical state files, and context segments are healthy',
1777
+ content: `---
1778
+ name: coherence-audit
1779
+ description: Verify topic-project bindings, project map freshness, canonical state files, and context segments are healthy
1780
+ metadata:
1781
+ user_invocable: "false"
1782
+ ---
1783
+
1784
+ # Coherence Audit — Awareness Infrastructure Health Check
1785
+
1786
+ ## Purpose
1787
+
1788
+ Verify that the agent's awareness infrastructure is healthy: topic bindings point to real directories, the project map is fresh, state files parse correctly, and context segments are present.
1789
+
1790
+ ## Procedure
1791
+
1792
+ Read the auth token once:
1793
+
1794
+ \\\`\\\`\\\`
1795
+ AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null)
1796
+ \\\`\\\`\\\`
1797
+
1798
+ Check each area:
1799
+
1800
+ ### 1. Topic-Project Bindings
1801
+
1802
+ \\\`\\\`\\\`
1803
+ curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/topic-bindings
1804
+ \\\`\\\`\\\`
1805
+
1806
+ - Are all bindings still valid?
1807
+ - Do the project directories they point to actually exist on disk?
1808
+ - Flag any bindings pointing to missing directories.
1809
+
1810
+ ### 2. Project Map Freshness
1811
+
1812
+ \\\`\\\`\\\`
1813
+ curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/project-map
1814
+ \\\`\\\`\\\`
1815
+
1816
+ - Check the \\\`generatedAt\\\` timestamp.
1817
+ - If older than 24 hours, trigger a refresh: \\\`POST /project-map/refresh\\\`
1818
+ - A stale map means project-map-refresh may be failing.
1819
+
1820
+ ### 3. Canonical State Files
1821
+
1822
+ Check these files exist and are parseable JSON:
1823
+ - \\\`.instar/quick-facts.json\\\`
1824
+ - \\\`.instar/anti-patterns.json\\\`
1825
+ - \\\`.instar/project-registry.json\\\`
1826
+
1827
+ Flag any that are missing, empty, or contain invalid JSON. Look for stale entries that reference things that no longer exist.
1828
+
1829
+ ### 4. Context Segments
1830
+
1831
+ \\\`\\\`\\\`
1832
+ curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/context
1833
+ \\\`\\\`\\\`
1834
+
1835
+ - Are all expected segments present?
1836
+ - Are any segments 0 bytes (empty)?
1837
+ - Missing context segments mean behavioral instructions may be lost.
1838
+
1839
+ ## On Issues Found
1840
+
1841
+ - Log findings as evolution learnings: \\\`POST /evolution/learnings\\\`
1842
+ - Fix what can be fixed automatically (e.g., refresh a stale map, remove broken bindings)
1843
+ - Exit silently if everything is healthy — no output means no problems
1844
+ `,
1845
+ },
1846
+ 'degradation-digest': {
1847
+ name: 'degradation-digest',
1848
+ description: 'Read DegradationReporter events, group repeated patterns, and escalate trends that need attention',
1849
+ content: `---
1850
+ name: degradation-digest
1851
+ description: Read DegradationReporter events, group repeated patterns, and escalate trends that need attention
1852
+ metadata:
1853
+ user_invocable: "false"
1854
+ ---
1855
+
1856
+ # Degradation Digest — Pattern Detection for Failing Features
1857
+
1858
+ ## Purpose
1859
+
1860
+ Review degradation events logged by the DegradationReporter, group repeated patterns, and escalate trends that indicate a primary path is reliably failing and needs fixing.
1861
+
1862
+ ## Procedure
1863
+
1864
+ Read the auth token:
1865
+
1866
+ \\\`\\\`\\\`
1867
+ AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null)
1868
+ \\\`\\\`\\\`
1869
+
1870
+ ### 1. Read Events
1871
+
1872
+ \\\`\\\`\\\`
1873
+ cat .instar/state/degradation-events.json
1874
+ \\\`\\\`\\\`
1875
+
1876
+ ### 2. Check Previous Digest
1877
+
1878
+ \\\`\\\`\\\`
1879
+ cat .instar/state/job-handoff-degradation-digest.md 2>/dev/null
1880
+ \\\`\\\`\\\`
1881
+
1882
+ Compare against the previous digest to identify new patterns vs. already-reported ones.
1883
+
1884
+ ### 3. Group by Feature
1885
+
1886
+ Count how many times each feature has degraded since the last digest.
1887
+
1888
+ ### 4. Escalate Patterns
1889
+
1890
+ For each feature with **3+ repeated degradations** — this is a PATTERN, not a one-off. The primary path is reliably failing.
1891
+
1892
+ Submit feedback for each pattern:
1893
+
1894
+ \\\`\\\`\\\`
1895
+ curl -s -X POST http://localhost:${port}/feedback \\
1896
+ -H "Authorization: Bearer $AUTH" \\
1897
+ -H 'Content-Type: application/json' \\
1898
+ -d '{"type":"bug","title":"Repeated degradation: FEATURE","description":"FEATURE has degraded N times. Primary: X. Fallback: Y. Most recent reason: Z. This pattern indicates the primary path needs fixing."}'
1899
+ \\\`\\\`\\\`
1900
+
1901
+ ### 5. Write Handoff Notes
1902
+
1903
+ \\\`\\\`\\\`
1904
+ echo "Last digest: $(date -u +%Y-%m-%dT%H:%M:%SZ). Events by feature: ..." > .instar/state/job-handoff-degradation-digest.md
1905
+ \\\`\\\`\\\`
1906
+
1907
+ ### 6. Exit Silently if Clean
1908
+
1909
+ If no patterns found (all one-offs), exit with no output.
1910
+ `,
1911
+ },
1912
+ 'state-integrity-check': {
1913
+ name: 'state-integrity-check',
1914
+ description: 'Cross-validate state file consistency, detect orphaned references and bloat',
1915
+ content: `---
1916
+ name: state-integrity-check
1917
+ description: Cross-validate state file consistency, detect orphaned references and bloat
1918
+ metadata:
1919
+ user_invocable: "false"
1920
+ ---
1921
+
1922
+ # State Integrity Check — Cross-Validation of Agent State
1923
+
1924
+ ## Purpose
1925
+
1926
+ Cross-validate agent state files for logical consistency. Detect orphaned references, bloated files, config-reality mismatches, and stale handoff notes. Fix what can be fixed automatically.
1927
+
1928
+ ## Procedure
1929
+
1930
+ Read the auth token:
1931
+
1932
+ \\\`\\\`\\\`
1933
+ AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null)
1934
+ \\\`\\\`\\\`
1935
+
1936
+ ### 1. Active Job Orphan
1937
+
1938
+ If \\\`.instar/state/active-job.json\\\` exists, verify the session it references is actually running:
1939
+
1940
+ \\\`\\\`\\\`
1941
+ curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/sessions
1942
+ \\\`\\\`\\\`
1943
+
1944
+ Check if the session name matches. If the session is dead but active-job.json persists, it's orphaned — delete it.
1945
+
1946
+ ### 2. Job-Topic Orphan
1947
+
1948
+ Read \\\`.instar/state/job-topic-mappings.json\\\`. For each mapping, verify the topic ID is reachable:
1949
+
1950
+ \\\`\\\`\\\`
1951
+ curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/telegram/topics
1952
+ \\\`\\\`\\\`
1953
+
1954
+ If topics have been deleted, the mapping is stale — flag it.
1955
+
1956
+ ### 3. State File Bloat
1957
+
1958
+ Check sizes of all state files. Any file over 1MB is a bloat signal. Common culprits:
1959
+ - \\\`degradation-events.json\\\` growing unbounded
1960
+ - Activity logs accumulating
1961
+
1962
+ Report bloated files and prune where safe.
1963
+
1964
+ ### 4. Config-Reality Match
1965
+
1966
+ Read \\\`.instar/config.json\\\`. If Telegram is configured, verify the bot is connected:
1967
+
1968
+ \\\`\\\`\\\`
1969
+ curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/health
1970
+ \\\`\\\`\\\`
1971
+
1972
+ Check if the telegram field shows connected. If config says telegram but health says disconnected, report the discrepancy.
1973
+
1974
+ ### 5. Handoff Note Staleness
1975
+
1976
+ Check \\\`.instar/state/job-handoff-*.md\\\` files. If any are older than 7 days and reference state that may have changed, flag them as potentially stale.
1977
+
1978
+ ## On Issues Found
1979
+
1980
+ - Submit feedback for each issue found
1981
+ - Fix what you can automatically (delete orphaned active-job.json, prune bloated files)
1982
+ - Exit silently if everything checks out — no output means no problems
1983
+ `,
1984
+ },
1985
+ 'memory-hygiene': {
1986
+ name: 'memory-hygiene',
1987
+ description: 'Review MEMORY.md for stale entries, duplicates, and quality issues — propose cleanup',
1988
+ content: `---
1989
+ name: memory-hygiene
1990
+ description: Review MEMORY.md for stale entries, duplicates, and quality issues — propose cleanup
1991
+ metadata:
1992
+ user_invocable: "false"
1993
+ ---
1994
+
1995
+ # Memory Hygiene — MEMORY.md Quality Review
1996
+
1997
+ ## Purpose
1998
+
1999
+ Review \\\`.instar/MEMORY.md\\\` for quality and hygiene. Memory is identity — stale or noisy entries actively mislead future sessions. This job keeps memory clean, consolidated, and actionable.
2000
+
2001
+ ## Procedure
2002
+
2003
+ Read the auth token:
2004
+
2005
+ \\\`\\\`\\\`
2006
+ AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null)
2007
+ \\\`\\\`\\\`
2008
+
2009
+ Read the full file: \\\`cat .instar/MEMORY.md\\\`
2010
+
2011
+ Evaluate each entry against these criteria:
2012
+
2013
+ ### 1. Staleness
2014
+
2015
+ Does this entry reference files, APIs, URLs, or features that no longer exist? Verify by checking if referenced paths exist (\\\`ls\\\`, \\\`curl\\\`). Stale entries actively mislead future sessions.
2016
+
2017
+ ### 2. Duplicates
2018
+
2019
+ Are multiple entries saying the same thing in different words? Consolidate them into a single, stronger entry.
2020
+
2021
+ ### 3. Abstraction Without Substance
2022
+
2023
+ Does the entry say something concrete and actionable, or is it a vague platitude?
2024
+
2025
+ - **Good:** "The /api/chat endpoint caches responses for 5 minutes — bypass with ?nocache=1"
2026
+ - **Bad:** "Remember to check caching behavior."
2027
+
2028
+ ### 4. Size Check
2029
+
2030
+ Count total words. If MEMORY.md exceeds 5000 words, it's becoming a burden on context rather than an aid. Identify the bottom 20% by usefulness and propose removing them.
2031
+
2032
+ ### 5. Organization
2033
+
2034
+ Are entries grouped by topic? Is the structure navigable? Reorganize if needed.
2035
+
2036
+ ## On Issues Found
2037
+
2038
+ - Fix duplicates and minor cleanups directly (edit the file)
2039
+ - For significant deletions, add a comment \\\`PROPOSED REMOVAL: [reason]\\\` rather than deleting — let the next reflection-trigger or human confirm
2040
+ - Log a learning if you discover a pattern:
2041
+
2042
+ \\\`\\\`\\\`
2043
+ curl -s -X POST http://localhost:${port}/evolution/learnings \\
2044
+ -H "Authorization: Bearer $AUTH" \\
2045
+ -H 'Content-Type: application/json' \\
2046
+ -d '{"category":"memory","insight":"...","confidence":"high"}'
2047
+ \\\`\\\`\\\`
2048
+
2049
+ ## Handoff
2050
+
2051
+ Write handoff notes:
2052
+
2053
+ \\\`\\\`\\\`
2054
+ echo "Last hygiene: $(date). Words: N. Entries: N. Removed: N. Flagged: N." > .instar/state/job-handoff-memory-hygiene.md
2055
+ \\\`\\\`\\\`
2056
+
2057
+ If MEMORY.md is clean and well-organized, exit silently.
2058
+ `,
2059
+ },
2060
+ 'guardian-pulse': {
2061
+ name: 'guardian-pulse',
2062
+ description: 'Meta-monitor that checks whether other jobs are running, healthy, and not silently failing',
2063
+ content: `---
2064
+ name: guardian-pulse
2065
+ description: Meta-monitor that checks whether other jobs are running, healthy, and not silently failing
2066
+ metadata:
2067
+ user_invocable: "false"
2068
+ ---
2069
+
2070
+ # Guardian Pulse — Job Health Meta-Monitor
2071
+
2072
+ ## Purpose
2073
+
2074
+ Check whether the guardians themselves are healthy. Monitors job execution, skip ledger trends, queue health, degradation reporter pipeline, and zombie sessions.
2075
+
2076
+ ## Procedure
2077
+
2078
+ Read the auth token:
2079
+
2080
+ \\\`\\\`\\\`
2081
+ AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null)
2082
+ \\\`\\\`\\\`
2083
+
2084
+ ### 1. Job Health
2085
+
2086
+ \\\`\\\`\\\`
2087
+ curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/jobs
2088
+ \\\`\\\`\\\`
2089
+
2090
+ For each enabled job, check:
2091
+ - Has it run at all? (lastRun should exist)
2092
+ - Is it overdue? (If lastRun is more than 3x the schedule interval ago, it's stuck)
2093
+ - Is it failing repeatedly? (consecutiveFailures > 0 is notable, > 2 is critical)
2094
+ - Is the lastError informative? (If it says "Session killed" repeatedly, something is wrong)
2095
+
2096
+ ### 2. Skip Ledger Trends
2097
+
2098
+ \\\`\\\`\\\`
2099
+ curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/skip-ledger/workloads
2100
+ \\\`\\\`\\\`
2101
+
2102
+ If any job has been skipped more than 10 times by its gate, the gate may be misconfigured (always returning skip), or the feature it monitors is permanently broken.
2103
+
2104
+ ### 3. Queue Health
2105
+
2106
+ Check queueLength from the jobs endpoint. If queue is perpetually > 0, jobs are backing up. This means maxParallelJobs is too low or jobs are running too long.
2107
+
2108
+ ### 4. Degradation Reporter Health
2109
+
2110
+ Read \\\`.instar/state/degradation-events.json\\\` — if events exist but none have \\\`reported:true\\\` or \\\`alerted:true\\\`, the downstream connections (FeedbackManager, Telegram) never initialized. The reporter is collecting but not communicating.
2111
+
2112
+ ### 5. Session Monitor
2113
+
2114
+ \\\`\\\`\\\`
2115
+ curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/sessions
2116
+ \\\`\\\`\\\`
2117
+
2118
+ Are there zombie sessions (status: running but started > 30 minutes ago for a job that should take 5)?
2119
+
2120
+ ## Output
2121
+
2122
+ For each finding, categorize:
2123
+ - **CRITICAL**: Job has been failing for > 24 hours, or meta-infrastructure (scheduler, reporter) is broken
2124
+ - **WARNING**: Job overdue, skip count high, queue growing
2125
+ - **INFO**: Minor observations
2126
+
2127
+ Report CRITICAL and WARNING issues. Exit silently if everything looks healthy.
2128
+
2129
+ Write handoff:
2130
+
2131
+ \\\`\\\`\\\`
2132
+ echo "Pulse at $(date). Jobs checked: N. Issues: [list or 'none']." > .instar/state/job-handoff-guardian-pulse.md
2133
+ \\\`\\\`\\\`
2134
+ `,
2135
+ },
2136
+ 'session-continuity-check': {
2137
+ name: 'session-continuity-check',
2138
+ description: 'Verify that sessions produce lasting artifacts like handoff notes, memory updates, and learnings',
2139
+ content: `---
2140
+ name: session-continuity-check
2141
+ description: Verify that sessions produce lasting artifacts like handoff notes, memory updates, and learnings
2142
+ metadata:
2143
+ user_invocable: "false"
2144
+ ---
2145
+
2146
+ # Session Continuity Check — Artifact Production Verification
2147
+
2148
+ ## Purpose
2149
+
2150
+ Check whether recent sessions contributed to long-term knowledge. Detects continuity leaks where knowledge is generated but not preserved.
2151
+
2152
+ ## Procedure
2153
+
2154
+ Read the auth token:
2155
+
2156
+ \\\`\\\`\\\`
2157
+ AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null)
2158
+ \\\`\\\`\\\`
2159
+
2160
+ ### 1. Recent Sessions
2161
+
2162
+ \\\`\\\`\\\`
2163
+ curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/sessions
2164
+ \\\`\\\`\\\`
2165
+
2166
+ Get sessions that completed in the last 8 hours.
2167
+
2168
+ ### 2. Job Session Artifacts
2169
+
2170
+ For each completed job session, check:
2171
+ - Does a handoff note exist? (\\\`.instar/state/job-handoff-{slug}.md\\\`)
2172
+ - Was it updated recently? (stat or date check)
2173
+ - If the job is reflection-trigger or insight-harvest, did MEMORY.md actually change? (Check git diff or file modification time)
2174
+
2175
+ ### 3. Interactive Session Artifacts
2176
+
2177
+ For non-job sessions, check:
2178
+ - Did the session produce any lasting artifacts? (git log for commits, MEMORY.md changes, new files in .instar/)
2179
+ - If a long session (>10 minutes) left no trace, that's a continuity leak — knowledge was generated but not preserved.
2180
+
2181
+ ### 4. Handoff Note Freshness
2182
+
2183
+ \\\`\\\`\\\`
2184
+ ls -la .instar/state/job-handoff-*.md
2185
+ \\\`\\\`\\\`
2186
+
2187
+ - Any handoff note older than 7 days for an active job? It might contain stale claims.
2188
+ - Flag stale handoff notes as potential misinformation vectors.
2189
+
2190
+ ## Output
2191
+
2192
+ - If sessions are running but not producing artifacts: propose an evolution to improve the reflection-trigger or add post-session hooks
2193
+ - If handoff notes are stale: add a "[STALE]" prefix to the file so the next job session treats it with appropriate skepticism
2194
+
2195
+ Write handoff:
2196
+
2197
+ \\\`\\\`\\\`
2198
+ echo "Continuity check at $(date). Sessions reviewed: N. Artifacts found: N. Gaps: N." > .instar/state/job-handoff-session-continuity-check.md
2199
+ \\\`\\\`\\\`
2200
+
2201
+ Exit silently if continuity is healthy.
2202
+ `,
2203
+ },
2204
+ 'git-sync': {
2205
+ name: 'git-sync',
2206
+ description: 'Intelligent multi-machine git sync with tiered model escalation — haiku for clean syncs, opus subagent for complex merge conflicts',
2207
+ content: `---
2208
+ name: git-sync
2209
+ description: Intelligent multi-machine git sync with tiered model escalation — haiku for clean syncs, opus subagent for complex merge conflicts
2210
+ metadata:
2211
+ user_invocable: "false"
2212
+ ---
2213
+
2214
+ # git-sync — Tiered Model Escalation Sync
2215
+
2216
+ ## Purpose
2217
+
2218
+ Synchronize this machine's state with the remote repository. Uses tiered model selection: the main session (haiku) handles clean syncs and simple merges. Complex conflicts spawn an opus subagent for semantic resolution.
2219
+
2220
+ ## Pre-flight
2221
+
2222
+ 1. Read conflict severity from gate:
2223
+ \\\`\\\`\\\`bash
2224
+ SEVERITY=$(cat /tmp/instar-git-sync-severity 2>/dev/null || echo "clean")
2225
+ \\\`\\\`\\\`
2226
+ 2. Get current state:
2227
+ \\\`\\\`\\\`bash
2228
+ git status --short
2229
+ git log --oneline -3
2230
+ git fetch origin && git rev-list --left-right --count HEAD...@{u}
2231
+ \\\`\\\`\\\`
2232
+
2233
+ ## Sync Strategy
2234
+
2235
+ ### Only behind (remote has new commits, no local changes)
2236
+ \\\`\\\`\\\`bash
2237
+ git pull --rebase
2238
+ \\\`\\\`\\\`
2239
+ Report what was pulled.
2240
+
2241
+ ### Only ahead (local changes, nothing new on remote)
2242
+ \\\`\\\`\\\`bash
2243
+ git add -A
2244
+ \\\`\\\`\\\`
2245
+ Compose a brief sync commit message categorizing the changes (state, config, skills, code, etc.):
2246
+ \\\`\\\`\\\`bash
2247
+ git commit -m "sync: auto-commit"
2248
+ git push
2249
+ \\\`\\\`\\\`
2250
+
2251
+ ### Both sides have changes — TIERED RESOLUTION
2252
+
2253
+ First, commit local changes:
2254
+ \\\`\\\`\\\`bash
2255
+ git add -A && git commit -m "sync: local changes"
2256
+ \\\`\\\`\\\`
2257
+
2258
+ Then attempt rebase:
2259
+ \\\`\\\`\\\`bash
2260
+ git pull --rebase
2261
+ \\\`\\\`\\\`
2262
+
2263
+ **If no conflicts:** Push and report.
2264
+
2265
+ **If conflicts arise**, check severity and resolve based on tier:
2266
+
2267
+ #### Tier 1: Clean / State conflicts (handle directly)
2268
+
2269
+ For JSON state files (.instar/state/, activity caches, session data, ledgers):
2270
+ - Take newer timestamps
2271
+ - Union arrays by ID (no duplicates)
2272
+ - Take max for counters and offsets
2273
+ - For \\\`.instar/config.json\\\`: preserve local machine-specific values, take newer shared settings
2274
+
2275
+ For simple text conflicts (non-overlapping changes, whitespace):
2276
+ - Resolve mechanically
2277
+
2278
+ After resolving:
2279
+ \\\`\\\`\\\`bash
2280
+ git add . && git rebase --continue
2281
+ git push
2282
+ \\\`\\\`\\\`
2283
+
2284
+ #### Tier 2: Complex conflicts (spawn opus subagent)
2285
+
2286
+ If SEVERITY is "code" OR if you encounter conflicts in:
2287
+ - Source code files (.ts, .tsx, .js, .jsx, .py, .rs, .go)
2288
+ - Identity/memory files (MEMORY.md, AGENT.md, USER.md)
2289
+ - Skill definitions (.claude/skills/)
2290
+ - Any conflict where both sides made semantic changes to the same logic
2291
+
2292
+ **DO NOT attempt to resolve these yourself.** Instead:
2293
+
2294
+ 1. Collect the conflict context:
2295
+ \\\`\\\`\\\`bash
2296
+ git diff --name-only --diff-filter=U
2297
+ \\\`\\\`\\\`
2298
+ 2. For each conflicted file, read the full content including conflict markers
2299
+ 3. Get the merge base version for context:
2300
+ \\\`\\\`\\\`bash
2301
+ git show :1:<filename> # base
2302
+ git show :2:<filename> # ours
2303
+ git show :3:<filename> # theirs
2304
+ \\\`\\\`\\\`
2305
+ 4. **Spawn an opus subagent** using the Agent tool with these parameters:
2306
+ - \\\`model: "opus"\\\`
2307
+ - \\\`description: "Resolve git merge conflicts"\\\`
2308
+ - Prompt must include:
2309
+ - The base, ours, and theirs versions of each conflicted file
2310
+ - A summary of what each side was trying to do (from recent git log)
2311
+ - Instructions to output the resolved file content
2312
+ - The instruction: "Resolve semantically. Preserve intent from both sides. If the changes are truly incompatible, prefer the local (ours) version but note what was dropped."
2313
+
2314
+ 5. Apply the opus subagent's resolution:
2315
+ \\\`\\\`\\\`bash
2316
+ # Write resolved content to each file
2317
+ git add <resolved-files>
2318
+ git rebase --continue
2319
+ git push
2320
+ \\\`\\\`\\\`
2321
+
2322
+ 6. Report what conflicted, what the opus subagent decided, and why.
2323
+
2324
+ ### If clean (gate passed but nothing obvious)
2325
+ Re-check with \\\`git status\\\` and \\\`git fetch\\\`. If truly nothing: exit silently.
2326
+
2327
+ ## Safety Rules
2328
+
2329
+ - **NEVER** force push
2330
+ - **NEVER** delete branches
2331
+ - If a rebase goes wrong: \\\`git rebase --abort\\\` and report the issue
2332
+ - If the opus subagent's resolution looks wrong (e.g., deleted large chunks of code), abort and report rather than pushing a bad merge
2333
+ - Prefer clean history (rebase) over merge commits when possible
2334
+
2335
+ ## Reporting
2336
+
2337
+ - Nothing happened: exit silently
2338
+ - Clean sync: brief one-line ("Pulled 3 commits, pushed 2")
2339
+ - Tier 1 conflicts resolved: describe what conflicted and the mechanical resolution
2340
+ - Tier 2 conflicts resolved: describe what conflicted, the opus subagent's reasoning, and the resolution
2341
+ - Unresolvable: report details, leave working tree clean (abort rebase), queue attention item
2342
+
2343
+ ## Handoff Notes
2344
+
2345
+ Write sync results to \\\`.instar/state/job-handoff-git-sync.md\\\`:
2346
+ - Last sync timestamp
2347
+ - Any conflicts encountered and how they were resolved
2348
+ - Any pending issues for next run
1772
2349
  `,
1773
2350
  },
1774
2351
  };
@@ -1789,14 +2366,14 @@ function getDefaultJobs(port) {
1789
2366
  description: 'Monitor server health, session status, and system resources.',
1790
2367
  schedule: '*/5 * * * *',
1791
2368
  priority: 'critical',
1792
- expectedDurationMinutes: 3,
2369
+ expectedDurationMinutes: 1,
1793
2370
  model: 'haiku',
1794
2371
  enabled: true,
1795
2372
  execute: {
1796
2373
  type: 'prompt',
1797
2374
  value: `Run a quick health check: verify the instar server is responding (curl http://localhost:${port}/health), check disk space (df -h), and report any issues. Only send a message if something needs attention — silence means healthy. IMPORTANT: If you find issues, describe them in plain conversational language. Never dump raw JSON, field names, error codes, or structured data. The user reads these on their phone — write like you're texting them a quick heads-up. If the health response includes a degradationSummary array, relay those narrative strings directly.`,
1798
2375
  },
1799
- tags: ['coherence', 'default'],
2376
+ tags: ['cat:guardian'],
1800
2377
  },
1801
2378
  {
1802
2379
  slug: 'reflection-trigger',
@@ -1811,7 +2388,7 @@ function getDefaultJobs(port) {
1811
2388
  type: 'prompt',
1812
2389
  value: 'Review what has happened in the last 4 hours by reading recent activity logs. If there are any learnings, patterns, or insights worth remembering, update .instar/MEMORY.md. If nothing significant happened, do nothing.',
1813
2390
  },
1814
- tags: ['coherence', 'default'],
2391
+ tags: ['cat:learning'],
1815
2392
  },
1816
2393
  {
1817
2394
  slug: 'relationship-maintenance',
@@ -1820,29 +2397,13 @@ function getDefaultJobs(port) {
1820
2397
  schedule: '0 9 * * *',
1821
2398
  priority: 'low',
1822
2399
  expectedDurationMinutes: 3,
1823
- model: 'opus',
2400
+ model: 'haiku',
1824
2401
  enabled: true,
1825
2402
  execute: {
1826
2403
  type: 'prompt',
1827
2404
  value: 'Review all relationship files in .instar/relationships/. Note anyone you haven\'t heard from in over 2 weeks who has significance >= 3. If there are observations worth surfacing, report them. If everything looks fine, do nothing.',
1828
2405
  },
1829
- tags: ['coherence', 'default'],
1830
- },
1831
- {
1832
- slug: 'update-check',
1833
- name: 'Update Check',
1834
- description: 'Legacy update check job — disabled because the built-in AutoUpdater handles updates automatically (check, apply, notify, restart). See GET /updates/auto for status.',
1835
- schedule: '*/30 * * * *',
1836
- priority: 'medium',
1837
- expectedDurationMinutes: 2,
1838
- model: 'haiku',
1839
- enabled: false,
1840
- gate: `curl -sf http://localhost:${port}/updates 2>/dev/null | python3 -c "import sys,json; d=json.load(sys.stdin); exit(0 if d.get('updateAvailable') else 1)"`,
1841
- execute: {
1842
- type: 'script',
1843
- value: `curl -s http://localhost:${port}/updates/auto`,
1844
- },
1845
- tags: ['coherence', 'default'],
2406
+ tags: ['cat:relationships', 'role:worker', 'exec:prompt'],
1846
2407
  },
1847
2408
  {
1848
2409
  slug: 'feedback-retry',
@@ -1858,92 +2419,7 @@ function getDefaultJobs(port) {
1858
2419
  type: 'script',
1859
2420
  value: `RESULT=$(curl -s -X POST http://localhost:${port}/feedback/retry 2>/dev/null); COUNT=$(echo "$RESULT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('retried',0))" 2>/dev/null || echo 0); [ "$COUNT" -gt "0" ] && echo "Feedback retry: $COUNT item(s) forwarded." || echo "Feedback retry: nothing pending."`,
1860
2421
  },
1861
- tags: ['coherence', 'default'],
1862
- },
1863
- {
1864
- slug: 'dispatch-check',
1865
- name: 'Dispatch Check',
1866
- description: 'Legacy dispatch check job — disabled because the built-in AutoDispatcher handles polling, evaluation, and execution automatically. See GET /dispatches/auto for status.',
1867
- schedule: '*/30 * * * *',
1868
- priority: 'medium',
1869
- expectedDurationMinutes: 2,
1870
- model: 'haiku',
1871
- enabled: false,
1872
- gate: `curl -sf http://localhost:${port}/dispatches 2>/dev/null | python3 -c "import sys,json; d=json.load(sys.stdin); exit(0 if d.get('newCount',0) > 0 else 1)"`,
1873
- execute: {
1874
- type: 'script',
1875
- value: `curl -s http://localhost:${port}/dispatches/auto`,
1876
- },
1877
- tags: ['coherence', 'default'],
1878
- },
1879
- {
1880
- slug: 'self-diagnosis',
1881
- name: 'Self-Diagnosis',
1882
- description: 'Proactively scan for issues with instar infrastructure, hooks, jobs, and state. Submit feedback for anything broken or suboptimal.',
1883
- schedule: '0 */2 * * *',
1884
- priority: 'medium',
1885
- expectedDurationMinutes: 3,
1886
- model: 'opus',
1887
- enabled: true,
1888
- gate: `curl -sf http://localhost:${port}/health >/dev/null 2>&1`,
1889
- execute: {
1890
- type: 'prompt',
1891
- value: `You are your own QA team. Scan for issues with your instar infrastructure and submit feedback for anything wrong.
1892
-
1893
- FIRST: Read your auth token for API calls:
1894
- AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null)
1895
-
1896
- Then check each area:
1897
-
1898
- 1. **Server health**: curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/health — is it responding? Are all fields present? Is status "ok" or "degraded"?
1899
- 2. **State files**: Check .instar/state/ — are JSON files parseable? Any empty or corrupted? Try: for f in .instar/state/*.json; do python3 -c "import json; json.load(open('$f'))" 2>&1 || echo "CORRUPT: $f"; done
1900
- 3. **Hook files**: Do all hooks in .instar/hooks/instar/ exist and have execute permissions? ls -la .instar/hooks/instar/
1901
- 4. **Job execution**: curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/jobs — are any jobs failing repeatedly? Check lastRun and lastError fields.
1902
- 5. **Quota**: curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/quota — is usage approaching limits?
1903
- 6. **Logs**: Check .instar/logs/server.log for recent errors: tail -50 .instar/logs/server.log | grep -i error
1904
- 7. **Settings coherence**: Are hooks in .claude/settings.json pointing to files that exist?
1905
- 8. **Design friction**: During your recent work, did anything feel unnecessarily difficult, confusing, or broken? Did you work around any issues?
1906
- 9. **CI health**: Check if the project has a GitHub repo and if CI is passing. Run: REPO=$(git remote get-url origin 2>/dev/null | sed 's/.*github.com[:/]//;s/.git$//'); if [ -n "$REPO" ]; then FAILURES=$(gh run list --repo "$REPO" --status failure --limit 3 --json databaseId,conclusion,headBranch,name,createdAt 2>/dev/null); if echo "$FAILURES" | python3 -c "import sys,json; runs=json.load(sys.stdin); exit(0 if runs else 1)" 2>/dev/null; then echo "CI FAILURES DETECTED in $REPO"; echo "$FAILURES"; echo ""; echo "FIX THESE NOW: Read the failure logs with 'gh run view RUN_ID --repo $REPO --log-failed', diagnose the issue, fix it, run tests locally, commit and push."; fi; fi
1907
-
1908
- For EACH issue found, submit feedback immediately:
1909
- curl -s -X POST http://localhost:${port}/feedback -H "Authorization: Bearer $AUTH" -H 'Content-Type: application/json' -d '{"type":"bug","title":"TITLE","description":"FULL_CONTEXT"}'
1910
-
1911
- For improvements (not bugs), use type "improvement" instead.
1912
-
1913
- IMPORTANT for CI failures: Don't just report them as feedback — FIX THEM. Read the logs, diagnose the root cause, apply the fix, run tests locally to verify, then commit and push. Only submit feedback if the fix is beyond your capability (e.g., requires credentials or external service changes). CI health is your responsibility as the agent running this project.
1914
-
1915
- If everything looks healthy, exit silently. Only report issues.`,
1916
- },
1917
- tags: ['coherence', 'default'],
1918
- },
1919
- {
1920
- slug: 'evolution-review',
1921
- name: 'Evolution Review',
1922
- description: 'Review pending evolution proposals, evaluate their merit, and implement approved ones.',
1923
- schedule: '0 */6 * * *',
1924
- priority: 'medium',
1925
- expectedDurationMinutes: 5,
1926
- model: 'opus',
1927
- enabled: true,
1928
- gate: `curl -sf http://localhost:${port}/evolution/proposals?status=proposed 2>/dev/null | python3 -c "import sys,json; d=json.load(sys.stdin); exit(0 if len(d.get('proposals',[])) > 0 else 1)"`,
1929
- execute: {
1930
- type: 'prompt',
1931
- value: `Review pending evolution proposals: curl -s http://localhost:${port}/evolution/proposals?status=proposed
1932
-
1933
- For each proposal:
1934
- 1. Read the title, description, type, and source
1935
- 2. Evaluate: Is this a genuine improvement? Is the effort worth the impact? Does it align with our goals?
1936
- 3. If approved, update status: curl -s -X PATCH http://localhost:${port}/evolution/proposals/EVO-XXX -H 'Content-Type: application/json' -d '{"status":"approved"}'
1937
- 4. Then implement it: create the skill/hook/job/config change described in the proposal
1938
- 5. After implementation, mark complete: curl -s -X PATCH http://localhost:${port}/evolution/proposals/EVO-XXX -H 'Content-Type: application/json' -d '{"status":"implemented","resolution":"What was done"}'
1939
-
1940
- If a proposal should be deferred or rejected, update with reason.
1941
-
1942
- Also check the dashboard: curl -s http://localhost:${port}/evolution — report any highlights to the user if they seem important.
1943
-
1944
- If no proposals need attention, exit silently.`,
1945
- },
1946
- tags: ['coherence', 'default', 'evolution'],
2422
+ tags: ['cat:infrastructure'],
1947
2423
  },
1948
2424
  {
1949
2425
  slug: 'insight-harvest',
@@ -1974,14 +2450,14 @@ Also update MEMORY.md with any patterns worth preserving long-term.
1974
2450
 
1975
2451
  If no actionable patterns found, exit silently.`,
1976
2452
  },
1977
- tags: ['coherence', 'default', 'evolution'],
2453
+ tags: ['cat:learning', 'evolution'],
1978
2454
  },
1979
2455
  {
1980
- slug: 'commitment-check',
1981
- name: 'Commitment Check',
1982
- description: 'Track action items and commitments. Surface overdue items and stale commitments.',
2456
+ slug: 'evolution-overdue-check',
2457
+ name: 'Evolution Overdue Check',
2458
+ description: 'Monitor overdue evolution actions and stale commitments. Report only no autonomous completing or cancelling.',
1983
2459
  schedule: '0 */4 * * *',
1984
- priority: 'low',
2460
+ priority: 'high',
1985
2461
  expectedDurationMinutes: 2,
1986
2462
  model: 'haiku',
1987
2463
  enabled: true,
@@ -2000,14 +2476,14 @@ Also check pending actions (curl -s http://localhost:${port}/evolution/actions?s
2000
2476
 
2001
2477
  If no overdue or stale items, exit silently.`,
2002
2478
  },
2003
- tags: ['coherence', 'default', 'evolution'],
2479
+ tags: ['cat:learning', 'role:worker', 'exec:prompt', 'pair:commitment-detection'],
2004
2480
  },
2005
2481
  {
2006
2482
  slug: 'project-map-refresh',
2007
2483
  name: 'Project Map Refresh',
2008
2484
  description: 'Regenerate the project territory map to keep spatial awareness current.',
2009
2485
  schedule: '0 */12 * * *',
2010
- priority: 'low',
2486
+ priority: 'medium',
2011
2487
  expectedDurationMinutes: 1,
2012
2488
  model: 'haiku',
2013
2489
  enabled: true,
@@ -2016,34 +2492,23 @@ If no overdue or stale items, exit silently.`,
2016
2492
  type: 'script',
2017
2493
  value: `RESULT=$(curl -s -X POST http://localhost:${port}/project-map/refresh -H "Authorization: Bearer $(python3 -c "import json; print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null)" 2>/dev/null); echo "$RESULT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(f'Project map refreshed: {d.get(\"totalFiles\",0)} files, {d.get(\"directories\",0)} dirs')" 2>/dev/null || echo "Project map refresh: done"`,
2018
2494
  },
2019
- tags: ['coherence', 'default', 'maintenance'],
2495
+ tags: ['cat:maintenance', 'role:worker', 'exec:script'],
2020
2496
  },
2021
2497
  {
2022
2498
  slug: 'coherence-audit',
2023
2499
  name: 'Coherence Audit',
2024
2500
  description: 'Verify topic-project bindings are still valid, state files are healthy, and no drift has occurred.',
2025
2501
  schedule: '0 */8 * * *',
2026
- priority: 'low',
2502
+ priority: 'medium',
2027
2503
  expectedDurationMinutes: 2,
2028
2504
  model: 'haiku',
2029
2505
  enabled: true,
2030
2506
  gate: `curl -sf http://localhost:${port}/health >/dev/null 2>&1`,
2031
2507
  execute: {
2032
- type: 'prompt',
2033
- value: `Run a coherence audit to verify the agent's awareness infrastructure is healthy.
2034
-
2035
- AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null)
2036
-
2037
- Check each area:
2038
-
2039
- 1. **Topic-Project Bindings**: curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/topic-bindings — are all bindings still valid? Do the project directories exist?
2040
- 2. **Project Map**: curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/project-map — is the map recent (check generatedAt)? If older than 24 hours, refresh it.
2041
- 3. **Canonical State**: Check .instar/quick-facts.json, .instar/anti-patterns.json, .instar/project-registry.json — are they parseable? Any stale entries?
2042
- 4. **Context Segments**: curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/context — are all segments present? Any with 0 bytes?
2043
-
2044
- If issues found, log them as learnings (POST /evolution/learnings) and fix what you can. Exit silently if healthy.`,
2508
+ type: 'skill',
2509
+ value: 'coherence-audit',
2045
2510
  },
2046
- tags: ['coherence', 'default', 'maintenance'],
2511
+ tags: ['cat:maintenance', 'role:worker', 'exec:skill'],
2047
2512
  },
2048
2513
  {
2049
2514
  slug: 'degradation-digest',
@@ -2056,25 +2521,10 @@ If issues found, log them as learnings (POST /evolution/learnings) and fix what
2056
2521
  enabled: true,
2057
2522
  gate: `test -f .instar/state/degradation-events.json && python3 -c "import json; events=json.load(open('.instar/state/degradation-events.json')); exit(0 if len(events) > 0 else 1)" 2>/dev/null`,
2058
2523
  execute: {
2059
- type: 'prompt',
2060
- value: `Review degradation events and surface patterns that need attention.
2061
-
2062
- AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null)
2063
-
2064
- 1. Read degradation events: cat .instar/state/degradation-events.json
2065
- 2. Group by feature — count how many times each feature degraded since the last digest
2066
- 3. Check if there's a previous digest: cat .instar/state/job-handoff-degradation-digest.md 2>/dev/null
2067
-
2068
- For each feature with repeated degradations (3+ events):
2069
- - This is a PATTERN, not a one-off. It means the primary path is reliably failing.
2070
- - Submit feedback: curl -s -X POST http://localhost:${port}/feedback -H "Authorization: Bearer $AUTH" -H 'Content-Type: application/json' -d '{"type":"bug","title":"Repeated degradation: FEATURE","description":"FEATURE has degraded N times. Primary: X. Fallback: Y. Most recent reason: Z. This pattern indicates the primary path needs fixing."}'
2071
-
2072
- Write handoff notes with the current event count per feature:
2073
- echo "Last digest: $(date -u +%Y-%m-%dT%H:%M:%SZ). Events by feature: ..." > .instar/state/job-handoff-degradation-digest.md
2074
-
2075
- If no patterns found (all one-offs), exit silently.`,
2524
+ type: 'skill',
2525
+ value: 'degradation-digest',
2076
2526
  },
2077
- tags: ['coherence', 'default', 'guardian'],
2527
+ tags: ['cat:guardian', 'role:worker', 'exec:skill'],
2078
2528
  },
2079
2529
  {
2080
2530
  slug: 'state-integrity-check',
@@ -2087,69 +2537,30 @@ If no patterns found (all one-offs), exit silently.`,
2087
2537
  enabled: true,
2088
2538
  gate: `curl -sf http://localhost:${port}/health >/dev/null 2>&1`,
2089
2539
  execute: {
2090
- type: 'prompt',
2091
- value: `Cross-validate agent state for logical consistency.
2092
-
2093
- AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null)
2094
-
2095
- Check each integrity constraint:
2096
-
2097
- 1. **Active job orphan**: If .instar/state/active-job.json exists, verify the session it references is actually running: curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/sessions | check if the session name matches. If the session is dead but active-job.json persists, it's orphaned — delete it.
2098
-
2099
- 2. **Job-topic orphan**: Read .instar/state/job-topic-mappings.json. For each mapping, verify the topic ID is reachable via: curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/telegram/topics — if topics have been deleted, the mapping is stale.
2100
-
2101
- 3. **State file bloat**: Check sizes: ls -la .instar/state/*.json | sort by size. Any file over 1MB is a bloat signal — report it. Common culprits: degradation-events.json growing unbounded, activity logs accumulating.
2102
-
2103
- 4. **Config-reality match**: Read .instar/config.json. If telegram is configured, verify the bot is connected: curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/health — check if telegram field shows connected. If config says telegram but health says disconnected, report the discrepancy.
2104
-
2105
- 5. **Handoff note staleness**: Check .instar/state/job-handoff-*.md files. If any are older than 7 days and reference state that may have changed, flag them as potentially stale.
2106
-
2107
- For each issue found, submit feedback. Fix what you can (delete orphaned active-job.json, prune bloated files). Exit silently if everything checks out.`,
2540
+ type: 'skill',
2541
+ value: 'state-integrity-check',
2108
2542
  },
2109
- tags: ['coherence', 'default', 'guardian'],
2543
+ tags: ['cat:guardian', 'role:worker', 'exec:skill'],
2110
2544
  },
2111
2545
  {
2112
2546
  slug: 'memory-hygiene',
2113
2547
  name: 'Memory Hygiene',
2114
2548
  description: 'Review MEMORY.md for stale entries, duplicates, and quality issues. Propose cleanup.',
2115
2549
  schedule: '0 */12 * * *',
2116
- priority: 'low',
2550
+ priority: 'high',
2117
2551
  expectedDurationMinutes: 5,
2118
2552
  model: 'opus',
2119
2553
  enabled: true,
2120
2554
  gate: `test -f .instar/MEMORY.md && wc -w < .instar/MEMORY.md | python3 -c "import sys; exit(0 if int(sys.stdin.read().strip()) > 100 else 1)" 2>/dev/null`,
2121
2555
  execute: {
2122
- type: 'prompt',
2123
- value: `Review .instar/MEMORY.md for quality and hygiene.
2124
-
2125
- Read the full file: cat .instar/MEMORY.md
2126
-
2127
- Evaluate each entry against these criteria:
2128
-
2129
- 1. **Staleness**: Does this entry reference files, APIs, URLs, or features that no longer exist? Verify by checking if referenced paths exist (ls, curl). Stale entries actively mislead future sessions.
2130
-
2131
- 2. **Duplicates**: Are multiple entries saying the same thing in different words? Consolidate them.
2132
-
2133
- 3. **Abstraction without substance**: Does the entry say something concrete and actionable, or is it a vague platitude? "Always verify before committing" without context of WHAT to verify is noise. Good: "The /api/chat endpoint caches responses for 5 minutes — bypass with ?nocache=1". Bad: "Remember to check caching behavior."
2134
-
2135
- 4. **Size check**: Count total words. If MEMORY.md exceeds 5000 words, it's becoming a burden on context rather than an aid. Identify the bottom 20% by usefulness and propose removing them.
2136
-
2137
- 5. **Organization**: Are entries grouped by topic? Is the structure navigable? Reorganize if needed.
2138
-
2139
- For issues found:
2140
- - Fix duplicates and minor cleanups directly (edit the file)
2141
- - For significant deletions, add a comment "PROPOSED REMOVAL: [reason]" rather than deleting — let the next reflection-trigger or human confirm
2142
- - Log a learning if you discover a pattern: curl -s -X POST http://localhost:${port}/evolution/learnings -H "Authorization: Bearer $AUTH" -H 'Content-Type: application/json' -d '{"category":"memory","insight":"...","confidence":"high"}'
2143
-
2144
- Write handoff: echo "Last hygiene: $(date). Words: N. Entries: N. Removed: N. Flagged: N." > .instar/state/job-handoff-memory-hygiene.md
2145
-
2146
- If MEMORY.md is clean and well-organized, exit silently.`,
2556
+ type: 'skill',
2557
+ value: 'memory-hygiene',
2147
2558
  },
2148
2559
  grounding: {
2149
2560
  requiresIdentity: true,
2150
2561
  contextFiles: ['MEMORY.md'],
2151
2562
  },
2152
- tags: ['coherence', 'default', 'guardian'],
2563
+ tags: ['cat:maintenance', 'role:worker', 'exec:skill'],
2153
2564
  },
2154
2565
  {
2155
2566
  slug: 'guardian-pulse',
@@ -2162,88 +2573,33 @@ If MEMORY.md is clean and well-organized, exit silently.`,
2162
2573
  enabled: true,
2163
2574
  gate: `curl -sf http://localhost:${port}/health >/dev/null 2>&1`,
2164
2575
  execute: {
2165
- type: 'prompt',
2166
- value: `Meta-monitor: check whether the guardians themselves are healthy.
2167
-
2168
- AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null)
2169
-
2170
- 1. **Job health**: curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/jobs
2171
- For each enabled job, check:
2172
- - Has it run at all? (lastRun should exist)
2173
- - Is it overdue? (If lastRun is more than 3x the schedule interval ago, it's stuck)
2174
- - Is it failing repeatedly? (consecutiveFailures > 0 is notable, > 2 is critical)
2175
- - Is the lastError informative? (If it says "Session killed" repeatedly, something is wrong)
2176
-
2177
- 2. **Skip ledger trends**: curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/skip-ledger/workloads
2178
- If any job has been skipped more than 10 times by its gate, the gate may be misconfigured (always returning skip), or the feature it monitors is permanently broken.
2179
-
2180
- 3. **Queue health**: curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/jobs — check queueLength.
2181
- If queue is perpetually > 0, jobs are backing up. This means maxParallelJobs is too low or jobs are running too long.
2182
-
2183
- 4. **Degradation reporter health**: Read .instar/state/degradation-events.json — if events exist but none have reported:true or alerted:true, the downstream connections (FeedbackManager, Telegram) never initialized. The reporter is collecting but not communicating.
2184
-
2185
- 5. **Session monitor**: curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/sessions
2186
- Are there zombie sessions (status: running but started > 30 minutes ago for a job that should take 5)?
2187
-
2188
- For each finding, categorize:
2189
- - CRITICAL: Job has been failing for > 24 hours, or meta-infrastructure (scheduler, reporter) is broken
2190
- - WARNING: Job overdue, skip count high, queue growing
2191
- - INFO: Minor observations
2192
-
2193
- Report CRITICAL and WARNING issues. Exit silently if everything looks healthy.
2194
-
2195
- Write handoff: echo "Pulse at $(date). Jobs checked: N. Issues: [list or 'none']." > .instar/state/job-handoff-guardian-pulse.md`,
2576
+ type: 'skill',
2577
+ value: 'guardian-pulse',
2196
2578
  },
2197
- tags: ['coherence', 'default', 'guardian', 'meta'],
2579
+ tags: ['cat:guardian', 'role:worker', 'exec:skill'],
2198
2580
  },
2199
2581
  {
2200
2582
  slug: 'session-continuity-check',
2201
2583
  name: 'Session Continuity Check',
2202
2584
  description: 'Verify that sessions produce lasting artifacts: handoff notes, memory updates, learnings.',
2203
2585
  schedule: '0 */4 * * *',
2204
- priority: 'low',
2586
+ priority: 'medium',
2205
2587
  expectedDurationMinutes: 2,
2206
2588
  model: 'haiku',
2207
2589
  enabled: true,
2208
2590
  gate: `curl -sf http://localhost:${port}/health >/dev/null 2>&1`,
2209
2591
  execute: {
2210
- type: 'prompt',
2211
- value: `Check whether recent sessions contributed to long-term knowledge.
2212
-
2213
- AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null)
2214
-
2215
- 1. **Recent sessions**: curl -s -H "Authorization: Bearer $AUTH" http://localhost:${port}/sessions
2216
- Get sessions that completed in the last 8 hours.
2217
-
2218
- 2. **For each completed job session**, check:
2219
- - Does a handoff note exist? (.instar/state/job-handoff-{slug}.md)
2220
- - Was it updated recently? (stat -f %m or date check)
2221
- - If the job is reflection-trigger or insight-harvest, did MEMORY.md actually change? (Check git diff or file modification time)
2222
-
2223
- 3. **For interactive sessions** (non-job), check:
2224
- - Did the session produce any lasting artifacts? (git log for commits, MEMORY.md changes, new files in .instar/)
2225
- - If a long session (>10 minutes) left no trace, that's a continuity leak — knowledge was generated but not preserved.
2226
-
2227
- 4. **Handoff note freshness**: ls -la .instar/state/job-handoff-*.md
2228
- - Any handoff note older than 7 days for an active job? It might contain stale claims.
2229
- - Flag stale handoff notes as potential misinformation vectors.
2230
-
2231
- Findings:
2232
- - If sessions are running but not producing artifacts: propose an evolution to improve the reflection-trigger or add post-session hooks
2233
- - If handoff notes are stale: add a "[STALE]" prefix to the file so the next job session treats it with appropriate skepticism
2234
-
2235
- Write handoff: echo "Continuity check at $(date). Sessions reviewed: N. Artifacts found: N. Gaps: N." > .instar/state/job-handoff-session-continuity-check.md
2236
-
2237
- Exit silently if continuity is healthy.`,
2592
+ type: 'skill',
2593
+ value: 'session-continuity-check',
2238
2594
  },
2239
- tags: ['coherence', 'default', 'guardian'],
2595
+ tags: ['cat:guardian', 'role:worker', 'exec:skill'],
2240
2596
  },
2241
2597
  {
2242
2598
  slug: 'memory-export',
2243
2599
  name: 'Memory Export',
2244
2600
  description: 'Regenerate MEMORY.md from SemanticMemory knowledge graph. Keeps the human-readable memory snapshot fresh without manual intervention.',
2245
2601
  schedule: '0 */6 * * *',
2246
- priority: 'low',
2602
+ priority: 'medium',
2247
2603
  expectedDurationMinutes: 1,
2248
2604
  model: 'haiku',
2249
2605
  enabled: true,
@@ -2252,7 +2608,7 @@ Exit silently if continuity is healthy.`,
2252
2608
  type: 'script',
2253
2609
  value: `AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null); AGENT=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('agentName','Agent'))" 2>/dev/null); RESULT=$(curl -s -X POST -H "Authorization: Bearer $AUTH" -H "Content-Type: application/json" -d "{\\"filePath\\":\\".instar/MEMORY.md\\",\\"agentName\\":\\"$AGENT\\"}" http://localhost:${port}/semantic/export-memory 2>/dev/null); COUNT=$(echo "$RESULT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('entityCount',0))" 2>/dev/null || echo 0); EXCLUDED=$(echo "$RESULT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('excludedCount',0))" 2>/dev/null || echo 0); [ "$COUNT" -gt "0" ] && echo "Memory export: $COUNT entities written to MEMORY.md ($EXCLUDED excluded below threshold)." || echo "Memory export: no entities to export."`,
2254
2610
  },
2255
- tags: ['memory', 'default', 'maintenance'],
2611
+ tags: ['cat:maintenance', 'role:worker', 'exec:script'],
2256
2612
  },
2257
2613
  {
2258
2614
  slug: 'git-sync',
@@ -2265,56 +2621,10 @@ Exit silently if continuity is healthy.`,
2265
2621
  enabled: true,
2266
2622
  gate: 'bash .claude/scripts/git-sync-gate.sh',
2267
2623
  execute: {
2268
- type: 'prompt',
2269
- value: `You are running a periodic git sync. Your job is to synchronize this machine's state with the remote repository intelligently.
2270
-
2271
- ## Pre-flight
2272
-
2273
- 1. Check conflict severity: \`cat /tmp/instar-git-sync-severity 2>/dev/null || echo "clean"\`
2274
- 2. Run: \`git status --short\` and \`git log --oneline -3\` to understand current state
2275
- 3. Run: \`git fetch origin && git rev-list --left-right --count HEAD...@{u}\` to see ahead/behind
2276
-
2277
- ## Sync Strategy
2278
-
2279
- ### If only behind (remote has new commits, no local changes):
2280
- - \`git pull --rebase\`
2281
- - Report what was pulled
2282
-
2283
- ### If only ahead (local changes, nothing new on remote):
2284
- - \`git add -A\`
2285
- - Compose a brief sync commit message categorizing the changes (state, config, skills, code, etc.)
2286
- - \`git commit\` then \`git push\`
2287
-
2288
- ### If both (changes on both sides):
2289
- - First commit local changes: \`git add -A && git commit -m "sync: local changes"\`
2290
- - Then pull with rebase: \`git pull --rebase\`
2291
- - If conflicts arise, resolve them:
2292
- - **JSON state files** (.instar/state/, activity caches, session data): Take newer timestamps, union arrays by ID, max counters
2293
- - **Memory/identity files** (MEMORY.md, AGENT.md): Merge content — keep additions from both sides
2294
- - **Code files** (.ts, .js, .py): Review carefully, understand both changes, merge semantically
2295
- - **Config files**: Preserve local machine-specific values, take newer shared settings
2296
- - After resolving: \`git add . && git rebase --continue\`
2297
- - Then push: \`git push\`
2298
-
2299
- ### If clean (gate passed but nothing obvious):
2300
- - The gate detected something — re-check with \`git status\` and \`git fetch\`
2301
- - If truly nothing: report "sync check complete, nothing to do"
2302
-
2303
- ## Reporting
2304
-
2305
- - If nothing happened: exit silently (no message needed)
2306
- - If changes synced cleanly: brief one-line summary ("Pulled 3 commits, pushed 2")
2307
- - If conflicts were resolved: describe what conflicted and how you resolved it
2308
- - If conflicts could NOT be resolved: report the conflict details and leave the working tree clean (abort rebase if needed)
2309
-
2310
- ## Important
2311
-
2312
- - NEVER force push
2313
- - NEVER delete branches
2314
- - If a rebase goes wrong, \`git rebase --abort\` and report the issue
2315
- - Prefer clean history (rebase) over merge commits when possible`,
2624
+ type: 'skill',
2625
+ value: 'git-sync',
2316
2626
  },
2317
- tags: ['infrastructure', 'default'],
2627
+ tags: ['cat:infrastructure', 'role:worker', 'exec:skill'],
2318
2628
  telegramNotify: false,
2319
2629
  },
2320
2630
  {
@@ -2322,7 +2632,7 @@ Exit silently if continuity is healthy.`,
2322
2632
  name: 'Capability Audit',
2323
2633
  description: 'Refresh the capability map and detect drift. Compute-first: only spawns LLM if changes detected.',
2324
2634
  schedule: '0 */6 * * *',
2325
- priority: 'low',
2635
+ priority: 'medium',
2326
2636
  expectedDurationMinutes: 1,
2327
2637
  model: 'haiku',
2328
2638
  enabled: true,
@@ -2335,7 +2645,7 @@ Exit silently if continuity is healthy.`,
2335
2645
  requiresIdentity: false,
2336
2646
  contextFiles: ['.instar/state/capability-manifest.json'],
2337
2647
  },
2338
- tags: ['coherence', 'default', 'maintenance'],
2648
+ tags: ['cat:maintenance', 'role:worker', 'exec:script'],
2339
2649
  },
2340
2650
  {
2341
2651
  slug: 'identity-review',
@@ -2381,7 +2691,156 @@ If everything is coherent and no reflection is needed, exit silently. Only repor
2381
2691
  contextFiles: ['AGENT.md', 'soul.md'],
2382
2692
  },
2383
2693
  telegramNotify: 'on-alert',
2384
- tags: ['identity', 'coherence', 'default'],
2694
+ tags: ['cat:identity', 'role:worker', 'exec:prompt'],
2695
+ },
2696
+ {
2697
+ slug: 'evolution-proposal-evaluate',
2698
+ name: 'Evolution Proposal Evaluate',
2699
+ description: 'Phase A: Read pending evolution proposals, evaluate their merit, accept or reject. Paired with evolution-proposal-implement.',
2700
+ schedule: '0 */6 * * *',
2701
+ priority: 'medium',
2702
+ expectedDurationMinutes: 3,
2703
+ model: 'sonnet',
2704
+ enabled: true,
2705
+ gate: `curl -sf http://localhost:${port}/evolution/proposals?status=proposed 2>/dev/null | python3 -c "import sys,json; d=json.load(sys.stdin); exit(0 if len(d.get('proposals',[])) > 0 else 1)"`,
2706
+ execute: {
2707
+ type: 'prompt',
2708
+ value: `Review pending evolution proposals: curl -s http://localhost:${port}/evolution/proposals?status=proposed\n\nFor each proposal:\n1. Read the title, description, type, and source\n2. Evaluate: Is this a genuine improvement? Is the effort worth the impact? Does it align with our goals?\n3. If approved, update status: curl -s -X PATCH http://localhost:${port}/evolution/proposals/EVO-XXX -H 'Content-Type: application/json' -d '{"status":"approved"}'\n4. If rejected or deferred, update with reason.\n\nDo NOT implement approved proposals — that's handled by the paired evolution-proposal-implement job.\n\nAlso check the dashboard: curl -s http://localhost:${port}/evolution — report any highlights to the user if they seem important.\n\nIf no proposals need attention, exit silently.`,
2709
+ },
2710
+ tags: ['cat:learning', 'role:worker', 'exec:prompt', 'pair:evolution-proposal-implement'],
2711
+ },
2712
+ {
2713
+ slug: 'evolution-proposal-implement',
2714
+ name: 'Evolution Proposal Implement',
2715
+ description: 'Phase B: Pick up approved evolution proposals and implement them with full context. Paired with evolution-proposal-evaluate.',
2716
+ schedule: '0 1,7,13,19 * * *',
2717
+ priority: 'medium',
2718
+ expectedDurationMinutes: 10,
2719
+ model: 'opus',
2720
+ enabled: true,
2721
+ gate: `curl -sf http://localhost:${port}/evolution/proposals?status=approved 2>/dev/null | python3 -c "import sys,json; d=json.load(sys.stdin); exit(0 if len(d.get('proposals',[])) > 0 else 1)"`,
2722
+ execute: {
2723
+ type: 'prompt',
2724
+ value: `Implement approved evolution proposals: curl -s http://localhost:${port}/evolution/proposals?status=approved\n\nFor each approved proposal:\n1. Read the full description and understand what needs to be built\n2. Implement it: create the skill/hook/job/config change described\n3. After implementation, mark complete: curl -s -X PATCH http://localhost:${port}/evolution/proposals/EVO-XXX -H 'Content-Type: application/json' -d '{"status":"implemented","resolution":"What was done"}'\n\nIf no approved proposals exist, exit silently.`,
2725
+ },
2726
+ grounding: {
2727
+ requiresIdentity: true,
2728
+ contextFiles: ['MEMORY.md', '.instar/context/development.md'],
2729
+ },
2730
+ tags: ['cat:learning', 'role:worker', 'exec:prompt', 'pair:evolution-proposal-evaluate'],
2731
+ },
2732
+ {
2733
+ slug: 'commitment-detection',
2734
+ name: 'Commitment Detection',
2735
+ description: 'Scan recent messages for promises and commitments, register them as evolution actions. Replaces CommitmentSentinel server process.',
2736
+ schedule: '*/5 * * * *',
2737
+ priority: 'high',
2738
+ expectedDurationMinutes: 1,
2739
+ model: 'haiku',
2740
+ enabled: true,
2741
+ gate: `curl -sf http://localhost:${port}/health >/dev/null 2>&1`,
2742
+ execute: {
2743
+ type: 'prompt',
2744
+ value: `Scan recent messages for commitments and promises.\n\nAUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('authToken',''))" 2>/dev/null)\n\n1. Read your bookmark: cat .instar/state/commitment-detection-bookmark.json 2>/dev/null || echo '{"lastProcessedId": 0}'\n2. Fetch new messages since bookmark from Telegram message log: tail -100 .instar/telegram-messages.jsonl\n3. For each new message, check: does it contain a commitment, promise, or action item? Look for patterns like 'I will', 'let me', 'I\\'ll build', 'we should', 'TODO', 'action item', deadlines, etc.\n4. For each detected commitment, register it: curl -s -X POST http://localhost:${port}/evolution/actions -H "Authorization: Bearer $AUTH" -H 'Content-Type: application/json' -d '{"title":"...","source":"commitment-detection","description":"...","dueDate":"..."}'\n5. Update bookmark with the last processed message ID.\n\nOnly process NEW messages since last bookmark. Exit silently if no new commitments found.`,
2745
+ },
2746
+ tags: ['cat:evolution', 'role:worker', 'exec:prompt', 'pair:evolution-overdue-check'],
2747
+ },
2748
+ {
2749
+ slug: 'dashboard-link-refresh',
2750
+ name: 'Dashboard Link Refresh',
2751
+ description: 'Refresh the pinned dashboard link in Telegram so it never goes stale.',
2752
+ schedule: '*/15 * * * *',
2753
+ priority: 'medium',
2754
+ expectedDurationMinutes: 1,
2755
+ model: 'haiku',
2756
+ enabled: true,
2757
+ gate: `curl -sf http://localhost:${port}/health >/dev/null 2>&1`,
2758
+ execute: {
2759
+ type: 'script',
2760
+ value: `AUTH=$(python3 -c "import json; print(json.load(open('.instar/config.json')).get('authToken','')).strip()" 2>/dev/null) && curl -sf -X POST -H "Authorization: Bearer $AUTH" http://localhost:${port}/telegram/dashboard-refresh`,
2761
+ },
2762
+ tags: ['cat:infrastructure', 'role:worker', 'exec:script'],
2763
+ telegramNotify: false,
2764
+ },
2765
+ {
2766
+ slug: 'overseer-guardian',
2767
+ name: 'Guardian Overseer',
2768
+ description: 'Reviews all guardian/monitoring jobs: health-check, guardian-pulse, degradation-digest, state-integrity-check, session-continuity-check. Spots cross-job patterns, flags contradictions, recommends schedule/priority/model changes.',
2769
+ schedule: '0 */6 * * *',
2770
+ priority: 'medium',
2771
+ expectedDurationMinutes: 5,
2772
+ model: 'sonnet',
2773
+ enabled: true,
2774
+ execute: {
2775
+ type: 'prompt',
2776
+ value: `You are a Category Overseer for the GUARDIAN category. Your job is to review all guardian/monitoring jobs and assess the health of the monitoring system itself.\n\n1. Fetch the category report: curl -H "Authorization: Bearer $AUTH" http://localhost:${port}/jobs/category-report/guardian?sinceHours=24\n2. Analyze the report for:\n - Jobs with high failure rates or consecutive failures\n - Jobs that are being skipped excessively (especially for quota reasons)\n - Schedule mismatches (jobs running too often or not often enough for their purpose)\n - Model over-allocation (could any job use a cheaper model?)\n - Contradictions between job findings (e.g., health-check says healthy but degradation-digest found issues)\n - Coverage gaps (are there monitoring blind spots?)\n3. Read the handoff notes from each job — do they tell a coherent story?\n4. If you find actionable issues, write a clear summary. If everything is healthy, say so briefly.\n\nWrite your findings in [HANDOFF] tags for the next overseer run. Focus on trends and cross-job insights that individual jobs can't see.`,
2777
+ },
2778
+ tags: ['cat:overseer', 'role:supervisor'],
2779
+ telegramNotify: 'on-alert',
2780
+ },
2781
+ {
2782
+ slug: 'overseer-learning',
2783
+ name: 'Learning Overseer',
2784
+ description: 'Reviews all evolution/learning jobs: evolution-review, insight-harvest, commitment-check, reflection-trigger. Assesses whether the learning pipeline is producing value.',
2785
+ schedule: '0 3 */2 * *',
2786
+ priority: 'medium',
2787
+ expectedDurationMinutes: 5,
2788
+ model: 'sonnet',
2789
+ enabled: true,
2790
+ execute: {
2791
+ type: 'prompt',
2792
+ value: `You are a Category Overseer for the LEARNING category. Your job is to review all evolution/learning jobs and assess whether the learning pipeline is producing genuine value.\n\n1. Fetch the category report: curl -H "Authorization: Bearer $AUTH" http://localhost:${port}/jobs/category-report/learning?sinceHours=48\n2. Analyze:\n - Are evolution proposals being generated AND accepted? What's the accept/reject ratio?\n - Is insight-harvest finding novel insights or recycling stale ones?\n - Are commitments being tracked and completed, or piling up?\n - Is reflection-trigger producing meaningful MEMORY.md updates?\n - Are any learning jobs consistently skipped due to quota? This means the learning pipeline is being starved.\n - Model costs: reflection-trigger uses opus — is the quality difference worth it vs sonnet?\n3. Look for the meta-pattern: is the agent actually getting smarter over time, or is the learning pipeline just busy-work?\n4. Check handoff notes for patterns across runs.\n\nWrite findings in [HANDOFF] tags. Flag if the learning pipeline is producing diminishing returns.`,
2793
+ },
2794
+ tags: ['cat:overseer', 'role:supervisor'],
2795
+ telegramNotify: 'on-alert',
2796
+ },
2797
+ {
2798
+ slug: 'overseer-maintenance',
2799
+ name: 'Maintenance Overseer',
2800
+ description: 'Reviews all maintenance jobs: project-map-refresh, coherence-audit, capability-audit, memory-hygiene, memory-export. Ensures housekeeping is effective.',
2801
+ schedule: '0 2 * * *',
2802
+ priority: 'medium',
2803
+ expectedDurationMinutes: 5,
2804
+ model: 'sonnet',
2805
+ enabled: true,
2806
+ execute: {
2807
+ type: 'prompt',
2808
+ value: `You are a Category Overseer for the MAINTENANCE category. Your job is to review all housekeeping/maintenance jobs and ensure they're keeping the system clean.\n\n1. Fetch the category report: curl -H "Authorization: Bearer $AUTH" http://localhost:${port}/jobs/category-report/maintenance?sinceHours=48\n2. Analyze:\n - Is memory-hygiene actually reducing stale entries, or finding nothing each run?\n - Is project-map-refresh keeping the map accurate? How often does it find drift?\n - Is coherence-audit finding real misalignments or just confirming everything is fine?\n - Are any maintenance jobs redundant with each other? (e.g., overlapping checks)\n - Are skill-type jobs (coherence-audit, memory-hygiene) running correctly?\n - Workload trends: are jobs processing fewer items over time (diminishing returns)?\n3. Maintenance jobs should trend toward finding LESS work over time. If they consistently find issues, something upstream is broken.\n\nWrite findings in [HANDOFF] tags. Recommend disabling or reducing frequency of jobs that consistently find nothing.`,
2809
+ },
2810
+ tags: ['cat:overseer', 'role:supervisor'],
2811
+ telegramNotify: 'on-alert',
2812
+ },
2813
+ {
2814
+ slug: 'overseer-infrastructure',
2815
+ name: 'Infrastructure Overseer',
2816
+ description: 'Reviews infrastructure jobs: git-sync, dashboard-link-refresh, feedback-retry. Ensures plumbing is solid.',
2817
+ schedule: '0 6 * * *',
2818
+ priority: 'medium',
2819
+ expectedDurationMinutes: 3,
2820
+ model: 'haiku',
2821
+ enabled: true,
2822
+ execute: {
2823
+ type: 'prompt',
2824
+ value: `You are a Category Overseer for the INFRASTRUCTURE category. Your job is to review infrastructure/plumbing jobs.\n\n1. Fetch the category report: curl -H "Authorization: Bearer $AUTH" http://localhost:${port}/jobs/category-report/infrastructure?sinceHours=48\n2. Analyze:\n - Is git-sync succeeding? Any merge conflicts or divergence?\n - Is dashboard-link-refresh keeping links current? Could it run less often?\n - Is feedback-retry actually retrying anything, or is the queue always empty?\n - Model allocation: git-sync uses high priority — is that justified by its failure rate?\n - Are any infrastructure jobs causing issues for other jobs (e.g., git-sync holding sessions)?\n3. Infrastructure jobs should be boring and reliable. Any excitement is a problem.\n\nWrite findings in [HANDOFF] tags. Keep it brief — infrastructure overseers should be the quietest.`,
2825
+ },
2826
+ tags: ['cat:overseer', 'role:supervisor'],
2827
+ telegramNotify: 'on-alert',
2828
+ },
2829
+ {
2830
+ slug: 'overseer-development',
2831
+ name: 'Development Overseer',
2832
+ description: 'Reviews development jobs: ci-monitor. Ensures development tooling is functional.',
2833
+ schedule: '0 8 * * *',
2834
+ priority: 'low',
2835
+ expectedDurationMinutes: 3,
2836
+ model: 'haiku',
2837
+ enabled: true,
2838
+ execute: {
2839
+ type: 'prompt',
2840
+ value: `You are a Category Overseer for the DEVELOPMENT category. Your job is to review development-focused jobs.\n\n1. Fetch the category report: curl -H "Authorization: Bearer $AUTH" http://localhost:${port}/jobs/category-report/development?sinceHours=48\n2. Analyze:\n - Are development jobs consuming appropriate resources for their value?\n - Are there CI/testing patterns that could be automated?\n3. Development jobs are only valuable when there's active development. If the codebase is stable, these could be reduced.\n\nWrite findings in [HANDOFF] tags.`,
2841
+ },
2842
+ tags: ['cat:overseer', 'role:supervisor'],
2843
+ telegramNotify: 'on-alert',
2385
2844
  },
2386
2845
  ];
2387
2846
  }