@lornatang/dsh-caveman 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/LICENSE +202 -0
  3. package/LICENSE-MIT +21 -0
  4. package/NOTICE +51 -0
  5. package/README.md +218 -0
  6. package/README.zh.md +218 -0
  7. package/cordis.patch.yml +3 -0
  8. package/examples/caveman-anthropic.patch.yml +14 -0
  9. package/examples/caveman-auto.patch.yml +15 -0
  10. package/lib/attribution.js +24 -0
  11. package/lib/blocks.js +80 -0
  12. package/lib/cavecrew-git.js +83 -0
  13. package/lib/cavecrew.js +67 -0
  14. package/lib/compression.js +434 -0
  15. package/lib/index.js +127 -0
  16. package/lib/memory.js +35 -0
  17. package/lib/mode.js +71 -0
  18. package/lib/native.js +357 -0
  19. package/lib/runtime.js +199 -0
  20. package/lib/skills.js +75 -0
  21. package/lib/stats.js +189 -0
  22. package/lib/types/attribution.d.ts +8 -0
  23. package/lib/types/blocks.d.ts +12 -0
  24. package/lib/types/cavecrew-git.d.ts +5 -0
  25. package/lib/types/cavecrew.d.ts +10 -0
  26. package/lib/types/compression.d.ts +50 -0
  27. package/lib/types/index.d.ts +30 -0
  28. package/lib/types/memory.d.ts +3 -0
  29. package/lib/types/mode.d.ts +33 -0
  30. package/lib/types/native.d.ts +43 -0
  31. package/lib/types/runtime.d.ts +23 -0
  32. package/lib/types/skills.d.ts +3 -0
  33. package/lib/types/stats.d.ts +6 -0
  34. package/package.json +129 -0
  35. package/presets/cavecrew.patch.yml +54 -0
  36. package/scripts/benchmark.mjs +79 -0
  37. package/scripts/caveman-cli.mjs +30 -0
  38. package/scripts/learn-binary.mjs +82 -0
  39. package/scripts/learn-checksums.json +29 -0
  40. package/vendor/caveman/LICENSE +202 -0
  41. package/vendor/caveman/LICENSE-MIT +21 -0
  42. package/vendor/caveman/NOTICE +49 -0
  43. package/vendor/caveman/agents/cavecrew-builder.md +46 -0
  44. package/vendor/caveman/agents/cavecrew-investigator.md +56 -0
  45. package/vendor/caveman/agents/cavecrew-reviewer.md +47 -0
  46. package/vendor/caveman/skills/activation-rule.mjs +43 -0
  47. package/vendor/caveman/skills/cavecrew/README.md +67 -0
  48. package/vendor/caveman/skills/cavecrew/SKILL.md +78 -0
  49. package/vendor/caveman/skills/caveman/README.md +68 -0
  50. package/vendor/caveman/skills/caveman/SKILL.md +89 -0
  51. package/vendor/caveman/skills/caveman-commit/README.md +44 -0
  52. package/vendor/caveman/skills/caveman-commit/SKILL.md +63 -0
  53. package/vendor/caveman/skills/caveman-compress/README.md +262 -0
  54. package/vendor/caveman/skills/caveman-compress/SECURITY.md +55 -0
  55. package/vendor/caveman/skills/caveman-compress/SKILL.md +114 -0
  56. package/vendor/caveman/skills/caveman-compress/scripts/__init__.py +9 -0
  57. package/vendor/caveman/skills/caveman-compress/scripts/__main__.py +3 -0
  58. package/vendor/caveman/skills/caveman-compress/scripts/benchmark.py +80 -0
  59. package/vendor/caveman/skills/caveman-compress/scripts/cli.py +94 -0
  60. package/vendor/caveman/skills/caveman-compress/scripts/compress.py +1331 -0
  61. package/vendor/caveman/skills/caveman-compress/scripts/detect.py +192 -0
  62. package/vendor/caveman/skills/caveman-compress/scripts/validate.py +440 -0
  63. package/vendor/caveman/skills/caveman-discover/SKILL.md +115 -0
  64. package/vendor/caveman/skills/caveman-evidence-review/SKILL.md +142 -0
  65. package/vendor/caveman/skills/caveman-explore/SKILL.md +42 -0
  66. package/vendor/caveman/skills/caveman-explore/package.json +12 -0
  67. package/vendor/caveman/skills/caveman-explore/tests/skill-file.test.mjs +44 -0
  68. package/vendor/caveman/skills/caveman-help/README.md +39 -0
  69. package/vendor/caveman/skills/caveman-help/SKILL.md +62 -0
  70. package/vendor/caveman/skills/caveman-learn/CLAUDE.md +32 -0
  71. package/vendor/caveman/skills/caveman-learn/README.md +38 -0
  72. package/vendor/caveman/skills/caveman-learn/SKILL.md +185 -0
  73. package/vendor/caveman/skills/caveman-learn/package.json +12 -0
  74. package/vendor/caveman/skills/caveman-learn/tests/index.js +1 -0
  75. package/vendor/caveman/skills/caveman-learn/tests/skill-file.test.mjs +54 -0
  76. package/vendor/caveman/skills/caveman-manage/SKILL.md +112 -0
  77. package/vendor/caveman/skills/caveman-optimize/SKILL.md +111 -0
  78. package/vendor/caveman/skills/caveman-review/README.md +33 -0
  79. package/vendor/caveman/skills/caveman-review/SKILL.md +53 -0
  80. package/vendor/caveman/skills/caveman-setup/SKILL.md +222 -0
  81. package/vendor/caveman/skills/caveman-stats/README.md +48 -0
  82. package/vendor/caveman/skills/caveman-stats/SKILL.md +17 -0
  83. package/vendor/caveman/skills/compile.mjs +298 -0
  84. package/vendor/caveman/skills/engine-mcp-tools.json +10 -0
  85. package/vendor/caveman/skills/generated/aider/pack.json +163 -0
  86. package/vendor/caveman/skills/generated/claude/pack.json +163 -0
  87. package/vendor/caveman/skills/generated/codex/pack.json +163 -0
  88. package/vendor/caveman/skills/generated/gemini/pack.json +163 -0
  89. package/vendor/caveman/skills/generated/hermes/pack.json +163 -0
  90. package/vendor/caveman/skills/generated/opencode/pack.json +163 -0
  91. package/vendor/caveman/skills/investigate-first/SKILL.md +16 -0
  92. package/vendor/caveman/skills/investigate-first/agents/openai.yaml +4 -0
  93. package/vendor/caveman/skills/lean-build/SKILL.md +18 -0
  94. package/vendor/caveman/skills/lean-build/agents/openai.yaml +4 -0
  95. package/vendor/caveman/skills/megacave/README.md +11 -0
  96. package/vendor/caveman/skills/megacave/SKILL.md +65 -0
  97. package/vendor/caveman/skills/migration/SKILL.md +17 -0
  98. package/vendor/caveman/skills/migration/agents/openai.yaml +4 -0
  99. package/vendor/caveman/skills/native/native-core.md +16 -0
  100. package/vendor/caveman/skills/registry.json +283 -0
  101. package/vendor/caveman/skills/safe-refactor/SKILL.md +16 -0
  102. package/vendor/caveman/skills/safe-refactor/agents/openai.yaml +4 -0
  103. package/vendor/caveman/skills/surgical-patch/SKILL.md +16 -0
  104. package/vendor/caveman/skills/surgical-patch/agents/openai.yaml +4 -0
  105. package/vendor/caveman/skills/ultracave/README.md +13 -0
  106. package/vendor/caveman/skills/ultracave/SKILL.md +63 -0
  107. package/vendor/caveman/skills/verbs-gate.mjs +213 -0
  108. package/vendor/caveman/skills/verify-and-stop/SKILL.md +16 -0
  109. package/vendor/caveman/skills/verify-and-stop/agents/openai.yaml +4 -0
  110. package/vendor/caveman/src/hooks/caveman-config.js +921 -0
  111. package/vendor/caveman/src/hooks/caveman-parse.js +342 -0
  112. package/vendor/caveman/src/hooks/package.json +3 -0
@@ -0,0 +1,79 @@
1
+ import { performance } from 'node:perf_hooks'
2
+ import { resolve } from 'node:path'
3
+ import { SessionModeTracker, resolveMode } from '../lib/mode.js'
4
+ import { createSkillProvider } from '../lib/skills.js'
5
+ import { CompressionHistoryIndex } from '../lib/compression.js'
6
+
7
+ function median(values) {
8
+ const sorted = [...values].sort((a, b) => a - b)
9
+ return sorted[Math.floor(sorted.length / 2)]
10
+ }
11
+
12
+ const events = Array.from({ length: 1000 }, (_, index) => ({
13
+ type: 'user/message', data: {
14
+ source: { kind: 'user' },
15
+ content: [{ type: 'text', text: index % 150 === 0 ? '/caveman ultra' : 'Inspect the current code and report the results.' }],
16
+ },
17
+ }))
18
+ const session = {
19
+ get seq() { return events.length },
20
+ snapshotEvents(from = 0, to = events.length) { return events.slice(from, to) },
21
+ }
22
+ const pending = [{ source: { kind: 'user' }, content: [{ type: 'text', text: 'continue' }] }]
23
+ const tracker = new SessionModeTracker()
24
+ tracker.resolve('manual', session, pending)
25
+ const full = []
26
+ const incremental = []
27
+ for (let index = 0; index < 101; index++) {
28
+ events.push({ type: 'turn/start', data: {} })
29
+ let start = performance.now()
30
+ const expected = resolveMode('manual', events, pending)
31
+ full.push(performance.now() - start)
32
+ start = performance.now()
33
+ const actual = tracker.resolve('manual', session, pending)
34
+ incremental.push(performance.now() - start)
35
+ if (actual.mode !== expected.mode || actual.action !== expected.action) throw new Error('mode results differ')
36
+ }
37
+ const provider = createSkillProvider(resolve('vendor/caveman/skills'))
38
+ const discovery = []
39
+ for (let index = 0; index < 31; index++) {
40
+ const start = performance.now()
41
+ const result = await provider.list({})
42
+ if (!result.complete || result.candidates.length !== 22) throw new Error('skill catalog is incomplete')
43
+ discovery.push(performance.now() - start)
44
+ }
45
+ const historyEvents = Array.from({ length: 5000 }, (_, index) => index % 2 === 0
46
+ ? { type: 'assistant/message', data: { message: { content: [{ type: 'tool-call', id: `call-${index}`, name: 'read' }] } } }
47
+ : { type: 'tool/result', data: { message: { content: [{ type: 'text', text: 'ordinary result' }] } } })
48
+ const historySession = {
49
+ get seq() { return historyEvents.length },
50
+ snapshotEvents(from = 0, to = historyEvents.length) { return historyEvents.slice(from, to) },
51
+ eventAt() { return undefined },
52
+ }
53
+ const history = new CompressionHistoryIndex()
54
+ history.read(historySession)
55
+ const fullHistory = []
56
+ const incrementalHistory = []
57
+ for (let index = 0; index < 101; index++) {
58
+ historyEvents.push({ type: 'turn/start', data: {} })
59
+ let start = performance.now()
60
+ const hasMarker = historySession.snapshotEvents().some(event => event.type === 'tool/result' &&
61
+ event.data.message.content.some(block => block.type === 'text' && block.text.includes('[caveman: shortened; exact original via caveman_retrieve handle=')))
62
+ const names = new Map()
63
+ for (const event of historySession.snapshotEvents()) {
64
+ if (event.type === 'assistant/message') for (const block of event.data.message.content) {
65
+ if (block.type === 'tool-call' && !names.has(block.id)) names.set(block.id, block.name)
66
+ }
67
+ }
68
+ fullHistory.push(performance.now() - start)
69
+ start = performance.now()
70
+ const actual = history.read(historySession)
71
+ history.read(historySession)
72
+ incrementalHistory.push(performance.now() - start)
73
+ if (actual.hasMarker !== hasMarker || actual.toolNames.size !== names.size) throw new Error('compression history differs')
74
+ }
75
+ console.log(JSON.stringify({
76
+ mode: { initialMessages: 1000, runs: full.length, fullReplayMedianMs: median(full), incrementalMedianMs: median(incremental) },
77
+ skills: { count: 22, runs: discovery.length, discoveryMedianMs: median(discovery) },
78
+ compressionHistory: { initialEvents: 5000, runs: fullHistory.length, fullScanMedianMs: median(fullHistory), incrementalMedianMs: median(incrementalHistory) },
79
+ }, null, 2))
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env node
2
+ import { spawn } from 'node:child_process'
3
+ import { constants } from 'node:os'
4
+ import { createRequire } from 'node:module'
5
+ import { dirname, join } from 'node:path'
6
+
7
+ const require = createRequire(import.meta.url)
8
+ const cli = join(dirname(require.resolve('@caveman-ai/cli/package.json')), 'dist', 'index.js')
9
+ const args = process.argv.slice(2)
10
+ let learnBinary
11
+ if (args[0] === 'learn' && !['--help', '-h', 'help'].includes(args[1])) {
12
+ try { learnBinary = await (await import('./learn-binary.mjs')).resolveLearnBinary() }
13
+ catch (error) { console.error(`dsh-caveman: ${error.message}`); process.exit(1) }
14
+ }
15
+ const direct = learnBinary && args[1] === 'locate'
16
+ const child = spawn(direct ? learnBinary : process.execPath, direct ? args : [cli, ...args], {
17
+ stdio: 'inherit', windowsHide: true,
18
+ env: learnBinary ? { ...process.env, CAVEMAN_PROXY_BIN: learnBinary } : process.env,
19
+ })
20
+
21
+ for (const signal of ['SIGINT', 'SIGTERM']) {
22
+ process.on(signal, () => { if (child.exitCode === null && child.signalCode === null) child.kill(signal) })
23
+ }
24
+ child.once('error', error => {
25
+ console.error(`dsh-caveman: could not start the CLI: ${error.message}`)
26
+ process.exitCode = 1
27
+ })
28
+ child.once('exit', (code, signal) => {
29
+ process.exitCode = code ?? (signal ? 128 + (constants.signals[signal] ?? 0) : 1)
30
+ })
@@ -0,0 +1,82 @@
1
+ import { createHash, randomBytes } from 'node:crypto'
2
+ import { createReadStream } from 'node:fs'
3
+ import { chmod, mkdir, open, readFile, rename, rm } from 'node:fs/promises'
4
+ import { homedir } from 'node:os'
5
+ import { join } from 'node:path'
6
+
7
+ const MAX_BINARY_BYTES = 120 * 1024 * 1024
8
+ const manifestUrl = new URL('./learn-checksums.json', import.meta.url)
9
+ const packageUrl = new URL('../package.json', import.meta.url)
10
+
11
+ async function fileDigest(path) {
12
+ try {
13
+ const hash = createHash('sha256')
14
+ for await (const chunk of createReadStream(path)) hash.update(chunk)
15
+ return hash.digest('hex')
16
+ } catch (error) {
17
+ if (error?.code === 'ENOENT') return undefined
18
+ throw error
19
+ }
20
+ }
21
+
22
+ /** Download and verify the executable once for the current platform and version. */
23
+ export async function resolveLearnBinary(options = {}) {
24
+ const { env = process.env, platform = process.platform, arch = process.arch } = options
25
+ if (env.DSH_CAVEMAN_LEARN_BINARY) return env.DSH_CAVEMAN_LEARN_BINARY
26
+ const manifest = options.manifest ?? JSON.parse(await readFile(manifestUrl, 'utf8'))
27
+ const version = JSON.parse(await readFile(packageUrl, 'utf8')).version
28
+ if (manifest.version !== version || !/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u.test(version)) throw new Error('Invalid analyzer version manifest')
29
+ const os = { linux: 'linux', darwin: 'darwin', win32: 'win32' }[platform]
30
+ const cpu = { x64: 'amd64', arm64: 'arm64' }[arch]
31
+ const entry = manifest.binaries?.[`${platform}-${arch}`]
32
+ const expectedName = os && cpu ? `dsh-caveman-learn_${os}_${cpu}` : undefined
33
+ if (!expectedName || entry?.name !== expectedName || !/^[a-f0-9]{64}$/u.test(entry.sha256 ?? '')) {
34
+ throw new Error(`No verified analyzer is available for ${platform}/${arch}`)
35
+ }
36
+ const directory = join(options.cacheRoot ?? join(homedir(), '.dsh', 'cache', 'dsh-caveman', 'learn'), version)
37
+ const target = join(directory, `${expectedName}${platform === 'win32' ? '.exe' : ''}`)
38
+ if (await fileDigest(target) === entry.sha256) return target
39
+ await mkdir(directory, { recursive: true, mode: 0o700 })
40
+ const temporary = join(directory, `.${expectedName}.${randomBytes(12).toString('hex')}.tmp`)
41
+ let handle
42
+ let dispatcher
43
+ try {
44
+ const url = `https://github.com/Lornatang/dsh-caveman/releases/download/v${version}/${expectedName}`
45
+ let fetcher = options.fetcher ?? fetch
46
+ if (!options.fetcher && (env.https_proxy || env.HTTPS_PROXY || env.http_proxy || env.HTTP_PROXY)) {
47
+ const { EnvHttpProxyAgent, fetch: proxyFetch } = await import('undici')
48
+ dispatcher = new EnvHttpProxyAgent({
49
+ httpProxy: env.http_proxy ?? env.HTTP_PROXY ?? '',
50
+ httpsProxy: env.https_proxy ?? env.HTTPS_PROXY ?? '',
51
+ noProxy: env.no_proxy ?? env.NO_PROXY ?? '',
52
+ })
53
+ fetcher = (input, init) => proxyFetch(input, { ...init, dispatcher })
54
+ }
55
+ const response = await fetcher(url, { signal: AbortSignal.timeout(120_000) })
56
+ if (!response.ok || !response.body) throw new Error(`Analyzer download failed (HTTP ${response.status})`)
57
+ const advertised = Number(response.headers.get('content-length'))
58
+ if (advertised > MAX_BINARY_BYTES) throw new Error('Analyzer download exceeds the size limit')
59
+ handle = await open(temporary, 'wx', 0o700)
60
+ const hash = createHash('sha256')
61
+ let size = 0
62
+ for await (const chunk of response.body) {
63
+ size += chunk.length
64
+ if (size > MAX_BINARY_BYTES) throw new Error('Analyzer download exceeds the size limit')
65
+ hash.update(chunk)
66
+ await handle.writeFile(chunk)
67
+ }
68
+ await handle.close()
69
+ handle = undefined
70
+ if (hash.digest('hex') !== entry.sha256) throw new Error('Analyzer checksum mismatch')
71
+ await chmod(temporary, 0o700)
72
+ try { await rename(temporary, target) } catch (error) {
73
+ // Another invocation may have finished the same verified download.
74
+ if (await fileDigest(target) !== entry.sha256) throw error
75
+ }
76
+ return target
77
+ } finally {
78
+ await handle?.close().catch(() => {})
79
+ await rm(temporary, { force: true }).catch(() => {})
80
+ await dispatcher?.destroy().catch(() => {})
81
+ }
82
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "version": "0.1.0",
3
+ "binaries": {
4
+ "linux-x64": {
5
+ "name": "dsh-caveman-learn_linux_amd64",
6
+ "sha256": "0bbc8d74cb5c1f7494fc6fed5582a1e0f0259200df490b4b866ce43ba555d889"
7
+ },
8
+ "linux-arm64": {
9
+ "name": "dsh-caveman-learn_linux_arm64",
10
+ "sha256": "b3ddb175c675023c6c091f26a1f992c545e03df0ccf46632a577e48db8ec1fa9"
11
+ },
12
+ "darwin-x64": {
13
+ "name": "dsh-caveman-learn_darwin_amd64",
14
+ "sha256": "8145380c71fe57e8829a856c808c887b271e6d004078ca989c23d997c61ffbab"
15
+ },
16
+ "darwin-arm64": {
17
+ "name": "dsh-caveman-learn_darwin_arm64",
18
+ "sha256": "03be0ecc7f9d4d0669edf1c79a5d3f20921e8d89d210fdadc99f0e2c16b1e7b4"
19
+ },
20
+ "win32-x64": {
21
+ "name": "dsh-caveman-learn_win32_amd64",
22
+ "sha256": "ce0b6834457c8f188c883b6c46892930b0fad63d85cf9f7033ddd53cc1fd5b4a"
23
+ },
24
+ "win32-arm64": {
25
+ "name": "dsh-caveman-learn_win32_arm64",
26
+ "sha256": "bceddc401c9711c6c67194dbf27e7a227100eb315397018affce9cd8ea0a2f5b"
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Julius Brussee
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,49 @@
1
+ Caveman
2
+ Copyright 2026 Julius Brussee
3
+
4
+ Before Caveman 3.0.0, the parts of this repository outside the Engine-linked
5
+ runtime were licensed under the MIT License (see LICENSING.md). Contributions
6
+ made to those parts before 3.0.0 were received under the MIT License and remain
7
+ available under it. Its copyright and permission notice is retained in
8
+ LICENSE-MIT.
9
+
10
+ This product includes third-party software:
11
+
12
+ - engine/pixel/ is a Go port of pxpipe (https://github.com/teamchong/pxpipe),
13
+ used under the MIT License.
14
+ Copyright (c) 2026 claude-image-proxy contributors
15
+
16
+ - The glyph atlases embedded in engine/pixel/assets/ are rasterized from:
17
+ - Spleen 5x8, Copyright (c) 2018-2026, Frederic Cambus.
18
+ BSD 2-Clause License.
19
+ - GNU Unifont 16.0.04, dual-licensed under the SIL Open Font License 1.1 and
20
+ the GNU GPL version 2 (or later) with the GNU font-embedding exception.
21
+
22
+ - browse/ links these MIT-licensed Go modules:
23
+ - github.com/chromedp/chromedp, Copyright (c) 2016-2025 Kenneth Shaw
24
+ - github.com/chromedp/cdproto, Copyright (c) 2016-2025 Kenneth Shaw
25
+ - github.com/chromedp/sysutil, Copyright (c) 2016-2017 Kenneth Shaw
26
+
27
+ - The runtime binaries and the container image link third-party Go modules
28
+ under the MIT, BSD-3-Clause and Apache-2.0 licenses. Their license texts, and
29
+ the Go runtime's, ship with every binary release as
30
+ THIRD_PARTY_GO_LICENSES.tar.gz and in the image under /licenses/third_party/.
31
+
32
+ - packages/cli/src/index.ts contains a port, with changes, of Qwen Code
33
+ 0.22.3's MCP server and permission-rule matchers and its tool-name
34
+ normalization (https://github.com/QwenLM/qwen-code), used under the Apache
35
+ License, Version 2.0.
36
+ Copyright 2025 Google LLC
37
+ Copyright 2025 Qwen
38
+
39
+ - The @caveman-ai/cli package bundles MIT-licensed npm packages
40
+ (@clack/prompts, @clack/core, sisteransi, fast-string-width,
41
+ fast-string-truncated-width, fast-wrap-ansi); see packages/cli/NOTICE.
42
+
43
+ - extension/fonts/ holds the Geist and Geist Mono fonts,
44
+ Copyright (c) 2023 Vercel, in collaboration with basement.studio,
45
+ under the SIL Open Font License 1.1.
46
+
47
+ Full license texts: engine/pixel/NOTICE, engine/pixel/assets/SPLEEN_LICENSE.txt,
48
+ engine/pixel/assets/UNIFONT_LICENSE.txt, browse/NOTICE, packages/cli/NOTICE, and
49
+ extension/fonts/GEIST_LICENSE.txt.
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: cavecrew-builder
3
+ description: >
4
+ Surgical 1-2 file edit. Typo fixes, single-function rewrites, mechanical
5
+ renames, comment removal, format-preserving tweaks. Hard refuses 3+ file
6
+ scope. Returns caveman diff receipt. Use when scope is bounded and
7
+ obvious; do NOT use for new features, new files (unless asked), or
8
+ cross-file refactors.
9
+ ---
10
+
11
+ Ultracave voice. Drop articles/filler. Code/paths exact, backticked. Tool runs: one status line in, one out; nothing between routine calls.
12
+
13
+ ## Scope
14
+
15
+ 1 file ideal. 2 OK. 3+ → refuse.
16
+ Edit existing only (new file iff user asked).
17
+ No new abstractions. No drive-by refactors. No comment additions.
18
+ No `Bash` available — cannot shell out, cannot push, cannot delete.
19
+
20
+ ## Workflow
21
+
22
+ 1. `Read` target(s). Never edit blind.
23
+ 2. `Edit` smallest diff that work.
24
+ 3. Re-`Read` to verify.
25
+ 4. Return receipt.
26
+
27
+ ## Output (receipt)
28
+
29
+ ```
30
+ <path:line-range> — <change ≤10 words>.
31
+ <path:line-range> — <change ≤10 words>.
32
+ verified: <re-read OK | mismatch @ path:line>.
33
+ ```
34
+
35
+ Diff is the artifact. Receipt is the proof. No exploration story.
36
+
37
+ ## Refusals (terminal lines)
38
+
39
+ 3+ files → `too-big. split: <n one-line tasks>.`
40
+ Destructive needed → `needs-confirm. op: <command>.`
41
+ Spec ambiguous → `ambiguous. ask: <one question>.`
42
+ Tests fail post-edit, can't fix in scope → `regressed. revert path:line. cause: <fragment>.`
43
+
44
+ ## Auto-clarity
45
+
46
+ Security or destructive paths → write normal English warning, then resume caveman.
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: cavecrew-investigator
3
+ description: >
4
+ Read-only code locator. Returns file:line table for "where is X defined",
5
+ "what calls Y", "list all uses of Z", "map this directory". Output is
6
+ caveman-compressed, one row per hit, to keep main-thread context small.
7
+ Refuses to suggest fixes.
8
+ model: haiku
9
+ ---
10
+
11
+ Ultracave voice. Drop articles/filler/hedging. Code/symbols/paths exact, backticked. Lead with answer. Tool runs: one status line in, one out; nothing between routine calls.
12
+
13
+ ## Job
14
+
15
+ Locate. Report. Stop. Never edit, never propose fix.
16
+
17
+ ## Output
18
+
19
+ ```
20
+ <path:line> — `<symbol>` — <≤6 word note>
21
+ <path:line> — `<symbol>` — <≤6 word note>
22
+ ```
23
+
24
+ Group with one-word header when 3+ rows: `Defs:` / `Refs:` / `Callers:` / `Tests:` / `Imports:` / `Sites:`.
25
+ Single hit → one line, no header.
26
+ Zero hits → `No match.`
27
+ Last line → totals: `2 defs, 5 refs.` (omit if 0 or 1).
28
+
29
+ ## Tools
30
+
31
+ `Grep` for symbols/strings. `Glob` for paths. `Read` only specific ranges. `Bash` for `git log -S`/`git grep`/`find` when faster.
32
+
33
+ ## Refusals
34
+
35
+ Asked to fix → `Read-only. Spawn cavecrew-builder.`
36
+ Asked to design → `Read-only. Spawn cavecrew-builder or use main thread.`
37
+
38
+ ## Auto-clarity
39
+
40
+ Security warnings, destructive ops → write normal English. Resume after.
41
+
42
+ ## Example
43
+
44
+ Q: "where symlink-safe flag write?"
45
+
46
+ ```
47
+ Defs:
48
+ - hooks/caveman-config.js:81 — `safeWriteFlag` — atomic write w/ O_NOFOLLOW
49
+ - hooks/caveman-config.js:160 — `readFlag` — paired reader
50
+ Callers:
51
+ - hooks/caveman-mode-tracker.js:33,87
52
+ - hooks/caveman-activate.js:40
53
+ Tests:
54
+ - tests/test_symlink_flag.js — 12 cases
55
+ 2 defs, 3 callers, 1 test file.
56
+ ```
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: cavecrew-reviewer
3
+ description: >
4
+ Diff/branch/file reviewer. One line per finding, severity-tagged, no praise,
5
+ no scope creep. Output format `path:line: <emoji> <severity>: <problem>. <fix>.`
6
+ Use for "review this PR", "review my diff", "audit this file". Skips
7
+ formatting nits unless they change meaning.
8
+ model: haiku
9
+ ---
10
+
11
+ Ultracave voice. Findings only. No "looks good", no "I'd suggest", no preamble. Tool runs: one status line in, one out; nothing between routine calls.
12
+
13
+ ## Severity
14
+
15
+ | Emoji | Tier | Use for |
16
+ |---|---|---|
17
+ | 🔴 | bug | Wrong output, crash, security hole, data loss |
18
+ | 🟡 | risk | Edge case, race, leak, perf cliff, missing guard |
19
+ | 🔵 | nit | Style, naming, micro-perf — emit only if user asked thorough |
20
+ | ❓ | question | Need author intent before judging |
21
+
22
+ ## Output
23
+
24
+ ```
25
+ path/to/file.ts:42: 🔴 bug: token expiry uses `<` not `<=`. Off-by-one allows expired tokens 1 tick.
26
+ path/to/file.ts:118: 🟡 risk: pool not closed on error path. Add `try/finally`.
27
+ src/utils.ts:7: ❓ question: why duplicate `.trim()` here?
28
+ totals: 1🔴 1🟡 1❓
29
+ ```
30
+
31
+ Zero findings → `No issues.`
32
+ File order, ascending line numbers within file.
33
+
34
+ ## Boundaries
35
+
36
+ - Review only what's in front of you. No "while we're here".
37
+ - No big-refactor proposals.
38
+ - Need more context → append `(see L<n> in <file>)`. Don't guess.
39
+ - Formatting nits skipped unless they change meaning.
40
+
41
+ ## Tools
42
+
43
+ `Bash` only for `git diff`/`git log -p`/`git show`. No mutating commands.
44
+
45
+ ## Auto-clarity
46
+
47
+ Security findings → state risk in plain English first sentence, then caveman fix line.