Skip to content

Commit 06d1e14

Browse files
Improve repo intake closeout and site reference capture
1 parent 638ce4d commit 06d1e14

11 files changed

Lines changed: 455 additions & 9 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ External skill catalogs such as [`openai/skills`](https://github.com/openai/skil
288288
- for repo-level Codex discoverability, prefer tracked `.codex/skills/` and keep `.agents/skills/` only when repo-local compatibility mirroring helps
289289
- keep workspace-wide reusable skill sources in `shared/skills/` and starter templates in `tools/templates/skills/`
290290
- keep the managed VoltAgent `DESIGN.md` catalog as an optional ability under `repos/abilities/voltagent-awesome-design-md` and copy only the specific `DESIGN.md` files a repo actually needs
291+
- use `tools/scripts/capture-site-reference.sh` when a repo needs a conservative `httrack`-based public-site reference capture plus a repo-local acquisition note under `ref/httrack/`
291292
- use `tools/scripts/use-design-md.sh` when you want a stable local mirror under `cache/design-md/catalog/` or need to copy one `DESIGN.md` into a repo root quickly
292293
- keep third-party orchestration layers and generated agent setup local-only unless there is a strong reason to publish them
293294
- do not add the whole upstream skill catalog to `repos/`, `tools/`, or as a submodule unless there is a very specific maintenance reason

docs/08-first-run-and-updates.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ If you are starting a fresh repo-aware chat and want a cheaper wake-up path, use
5050
`tools/scripts/generate-context-cache.sh --workspace --run`
5151
3. for `workspace-hub` work, also run:
5252
`tools/scripts/generate-context-cache.sh --repo workspace-hub --run`
53-
4. treat generated files under `cache/context/` as compact `L0` and `L1` summaries only
54-
5. trust tracked docs, manifests, and repo files over generated summaries whenever they differ
53+
4. if a repo was just added or its setup changed, close it into the current Codex thread with `tools/bin/workspace-memory save-repo <repo-path-or-name>`
54+
5. treat generated files under `cache/context/` as compact `L0` and `L1` summaries only
55+
6. trust tracked docs, manifests, and repo files over generated summaries whenever they differ
5556

5657
Suggested instruction for a fresh chat:
5758

docs/09-new-repo-baseline.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ When useful, add small explicit metadata instead of hidden assumptions:
3939
- `.workspace/agent-stack.json` when the repo intentionally supports tracked multi-tool agent hints such as OMX-ready or OpenCode-ready setup
4040
- `README.md` for repo purpose, setup, run instructions, preview notes, and cover block
4141
- `docs/cover.png` as the default repo-local cover path, even if it starts as a placeholder
42+
- a runnable launcher command file, preferably `local/commands/run-<repo>` inside the repo or `tools/local/commands/Run <repo>.command` in the workspace
4243
- `HANDOVER.md` when the repo needs a resumable state document
4344
- repo-level `AGENTS.md` only when the repo genuinely needs rules beyond the workspace baseline
4445
- `.codex/skills/` and optional `.codex/config.toml` when the repo should expose official Codex repo-local surfaces
@@ -72,10 +73,11 @@ Recommended intake order:
7273
2. Read existing setup sources such as `README.md`, `package.json`, `composer.json`, lockfiles, shell scripts, Local notes, or repo-local instruction files.
7374
3. Classify the repo conservatively and choose a runtime mode only after checking the files.
7475
4. Create `README.md` if it is missing, or tighten the current one if it exists but does not explain setup and preview.
75-
5. Add a repo-local cover image reference in the README, even if the image is a placeholder at first.
76-
6. Add `.workspace/project.json` only when runtime behavior is not obvious from the repo files.
77-
7. Add repo-level `AGENTS.md`, `HANDOVER.md`, or repo-local skills only when they solve a real repo-specific need.
78-
8. If README, HANDOVER, or durable setup docs were created or materially updated, run `tools/bin/workspace-memory save-repo <repo-name>` so the shared memory layer captures the repo state, related workspace docs, and the current Codex thread in one closeout step.
76+
5. Add a runnable launcher command file so the repo can be started without remembering the shell incantation.
77+
6. Add a repo-local cover image reference in the README, even if the image is a placeholder at first.
78+
7. Add `.workspace/project.json` only when runtime behavior is not obvious from the repo files.
79+
8. Add repo-level `AGENTS.md`, `HANDOVER.md`, or repo-local skills only when they solve a real repo-specific need.
80+
9. If README, HANDOVER, or durable setup docs were created or materially updated, run `tools/bin/workspace-memory save-repo <repo-path-or-name>` so the shared memory layer captures the repo state, related workspace docs, and the current Codex thread in one closeout step.
7981

8082
For MemPalace target metadata, prefer `.workspace/mempalace/` inside the repo rather than dropping `mempalace.yaml` or `entities.json` at the repo root.
8183

@@ -131,6 +133,7 @@ Do not present a public-site mirror as if it were the original source project.
131133

132134
1. Record the public source URL and the capture date in `README.md` or `HANDOVER.md`.
133135
2. State the acquisition method clearly, such as `wget`, `httrack`, or manual asset capture.
136+
If `httrack` is available, prefer the workspace wrapper `tools/scripts/capture-site-reference.sh --run <url> <target-dir>` so the repo gets a consistent capture note under `ref/httrack/`.
134137
3. Document what the repo is: deployed mirror, working local reference copy, or rebuild.
135138
4. Document what is not present: original source files, build tooling, history, server-side code, private APIs, and environment variables unless they were actually supplied.
136139
5. Serve the repo through a lightweight local server for testing; do not treat `file://` opening as the default verification path.
@@ -183,11 +186,12 @@ Keep the manifest lightweight. It should clarify runtime behaviour, not become a
183186

184187
For a repo to feel workspace-ready, it should ideally have:
185188

186-
1. a clear way to run or preview it
189+
1. a clear way to run or preview it, ideally via a tracked launcher command file
187190
2. a known runtime mode: `direct`, `external`, or explicit repo-native server mode
188191
3. a `README.md` that captures setup, run, and preview expectations
189192
4. a repo-local cover image path in the README, even if it begins as a placeholder
190-
5. enough docs that another person can resume work without guessing
193+
5. a Codex-friendly closeout path such as `tools/bin/workspace-memory save-repo <repo-path-or-name>`
194+
6. enough docs that another person can resume work without guessing
191195

192196
For GitHub-backed repos, that usually means enough repo-local docs to explain setup plus a readable issue and PR path. For local-only or git-only repos, it means the tracked local docs carry the same resumable context without pretending GitHub is required.
193197

docs/20-ai-context-side-load.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ Recommended sequence:
8585
3. let the chat use generated `entry.md`, `abstract.md`, and `overview.md` as the fast entry layer
8686
4. fall back to tracked docs, manifests, and repo files for any real decision or ambiguity
8787
5. regenerate or ignore the cache if Workspace Hub reports the side-load state as `stale` or `missing`
88+
6. if a repo intake just created or updated setup docs, close the repo into the current Codex thread with `tools/bin/workspace-memory save-repo <repo-path-or-name>` before continuing
8889

8990
Practical operator flow:
9091

@@ -99,6 +100,13 @@ Then start the chat with a handover instruction such as:
99100
100101
For repo-specific work, point the chat at the repo `entry.md` first, then the repo README or handover note only when the side-load packet is insufficient.
101102

103+
When a new repo folder was just added under `repos/`, use this order:
104+
105+
1. run repo intake in Workspace Hub or the equivalent repo-doc setup flow
106+
2. make sure the repo has a runnable launcher command file
107+
3. close the repo into memory with `tools/bin/workspace-memory save-repo <repo-path-or-name>`
108+
4. reopen the generated repo `entry.md` if you want the compact chat packet before deeper docs
109+
102110
## Source set
103111

104112
### Workspace

docs/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 2026-04-17
4+
5+
- Installed `httrack` for this workspace environment and added `tools/scripts/capture-site-reference.sh` as the repo-intake wrapper for public-site reference copies, with dry-run-by-default behavior, conservative same-domain defaults, and repo-local capture notes under `ref/httrack/`.
6+
- Updated the public repo-intake surfaces in [README](../README.md), [docs/README](README.md), [09-new-repo-baseline](09-new-repo-baseline.md), and [tools/templates/repo-docs/README.site-reference.template.md](../tools/templates/repo-docs/README.site-reference.template.md) so site-reference repos have one documented `httrack` path.
7+
38
## 2026-04-12
49

510
- Added `tools/local/commands/Run Knowledge Palace UI.command` as a workspace-level launcher for the Knowledge Palace local web UI, and aligned the workspace docs index plus repo docs so the command, current state, and next UI batches are documented together.

docs/HANDOVER.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ The current repo intake flow in `workspace-hub` is intentionally conservative.
123123
- it writes `.workspace/project.json` only when the repo appears to need explicit runtime metadata
124124
- it keeps an existing manifest if one is already present
125125
- it does not auto-install dependencies or auto-start runtimes as part of intake
126+
- it now attempts a `tools/bin/workspace-memory save-repo <repo-path-or-name>` closeout after repo intake so the current Codex thread captures the new repo setup
126127

127128
This keeps intake focused on first-pass repo clarity rather than hidden setup side effects.
128129

@@ -135,12 +136,14 @@ Current stance:
135136
- treat the result as one of: deployed mirror, working local reference copy, or clean rebuild
136137
- do not describe a public-site mirror as the original source project
137138
- record source URL, capture date, and acquisition method in `README.md` or `HANDOVER.md`
139+
- when `httrack` is available, prefer `tools/scripts/capture-site-reference.sh --run <url> <target-dir>` so the capture stays conservative by default and records a repo-local note under `ref/httrack/`
138140
- if automated capture misses files because of permissions or other blockers, provide the direct asset URLs to the user in chat
139141
- store any user-downloaded fallback files in a repo-local `ref/` folder with source notes
140142
- create a separate rebuild repo if maintainable editing is the real goal
141143

142-
The tracked template for this flow now lives at:
144+
The tracked helper surfaces for this flow now live at:
143145

146+
- `tools/scripts/capture-site-reference.sh`
144147
- `tools/templates/repo-docs/README.site-reference.template.md`
145148

146149
## Release verification status
@@ -908,3 +911,17 @@ Verification status for this local slice:
908911

909912
- `pnpm --dir "repos/workspace-hub" typecheck`
910913
- `pnpm --dir "repos/workspace-hub" test`
914+
915+
### Implementation update (2026-04-17, HTTrack site-reference intake wrapper)
916+
917+
Completed in the workspace root:
918+
919+
1. Installed `httrack` for the active workspace environment and verified it is available on `PATH`.
920+
2. Added `tools/scripts/capture-site-reference.sh` as the dry-run-by-default wrapper for public-site reference captures, with conservative same-domain defaults, optional passthrough HTTrack args, and repo-local capture notes under `ref/httrack/`.
921+
3. Updated the public repo-intake docs and the site-reference README template so the workspace now has one documented `httrack` path instead of leaving site capture as an ad hoc command.
922+
923+
Verification status for this local slice:
924+
925+
- `sh -n tools/scripts/capture-site-reference.sh`
926+
- `tools/scripts/capture-site-reference.sh https://example.com /Users/richard/Local\\ Sites/Codex\\ Workspace/cache/httrack-smoke-test`
927+
- `tools/scripts/capture-site-reference.sh --run https://example.com /Users/richard/Local\\ Sites/Codex\\ Workspace/cache/httrack-smoke-test-run`

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Useful maintenance scripts:
8686
- `tools/scripts/setup-workspace-profile.sh` provides a guided, non-destructive profile check for `core`, `hub`, `mixed-stack`, `wordpress`, `agent-enhanced`, `workflow-state`, `spec-driven`, and `ui-previews`.
8787
- `tools/scripts/manage-workspace-capabilities.sh` lists, installs, updates, enables, disables, or uninstalls tracked workspace abilities and core services, with dry-run mode by default.
8888
- `tools/scripts/update-github-refs.sh` remains the compatibility wrapper for update-only reviewed GitHub-ref flows and delegates to the capability lifecycle command.
89+
- `tools/scripts/capture-site-reference.sh` previews or runs an `httrack` capture for a public-site reference repo, using conservative same-domain defaults and writing capture notes under repo-local `ref/httrack/`.
8990
- `tools/scripts/use-design-md.sh` mirrors the managed VoltAgent `DESIGN.md` catalog ability into `cache/design-md/catalog/`, lists available site ids, and can copy a selected `DESIGN.md` into a repo root.
9091
- `tools/scripts/sync-reference-snapshots.sh` previews or refreshes ignored upstream reference snapshots under `tools/ref/`, with dry-run mode by default.
9192
- `tools/scripts/sync-codex-skills.sh` previews or syncs tracked workspace skill sources into repo `.codex/skills/` folders plus optional `.agents/skills/` compatibility mirrors, with dry-run mode by default.

repos/workspace-hub/server/repo-intake.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
import { execFile } from 'node:child_process'
12
import { access, copyFile, mkdir, readFile, writeFile } from 'node:fs/promises'
23
import path from 'node:path'
4+
import { promisify } from 'node:util'
35

46
import type { WorkspaceRepo } from '../src/types/workspace.ts'
57
import { writeRepoManifest } from './repo-manifest.ts'
68

9+
const execFileAsync = promisify(execFile)
710
const coverBlockStart = '<!-- workspace-hub:cover:start -->'
811
const coverBlockEnd = '<!-- workspace-hub:cover:end -->'
912
const readmeTemplateRelativePath = path.join(
@@ -40,6 +43,26 @@ async function fileExists(targetPath: string) {
4043
}
4144
}
4245

46+
async function saveRepoCloseout(workspaceRoot: string, repoPath: string) {
47+
const workspaceMemoryPath = path.join(workspaceRoot, 'tools', 'bin', 'workspace-memory')
48+
49+
if (!(await fileExists(workspaceMemoryPath))) {
50+
return 'Workspace memory wrapper not found, so the Codex-thread closeout was skipped.'
51+
}
52+
53+
try {
54+
await execFileAsync(workspaceMemoryPath, ['save-repo', repoPath], {
55+
cwd: workspaceRoot,
56+
env: process.env,
57+
maxBuffer: 1024 * 1024 * 16,
58+
})
59+
return 'Repo closeout was saved to workspace memory for the current Codex thread.'
60+
} catch (error) {
61+
const message = error instanceof Error ? error.message : 'unknown error'
62+
return `Workspace memory closeout failed: ${message}`
63+
}
64+
}
65+
4366
function sanitizeAltText(value: string) {
4467
return value.replace(/[[\]]/g, '').trim() || 'Repo cover'
4568
}
@@ -318,6 +341,8 @@ export async function runRepoIntake(
318341
notes.push('Manifest skipped because runtime behavior looks clear from the repo files.')
319342
}
320343

344+
notes.push(await saveRepoCloseout(workspaceRoot, repo.relativePath))
345+
321346
return {
322347
coverCreated,
323348
coverImagePath,

0 commit comments

Comments
 (0)