lightcone-cli 0.2.0__py3-none-any.whl

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. lightcone/cli/__init__.py +16 -0
  2. lightcone/cli/claude/lightcone/agents/lc-extractor.md +114 -0
  3. lightcone/cli/claude/lightcone/guides/astra-reference.md +290 -0
  4. lightcone/cli/claude/lightcone/guides/lightcone-cli-reference.md +75 -0
  5. lightcone/cli/claude/lightcone/guides/ui-brand.md +86 -0
  6. lightcone/cli/claude/lightcone/hooks/langfuse_git_commit_hook.py +303 -0
  7. lightcone/cli/claude/lightcone/hooks/langfuse_hook.py +894 -0
  8. lightcone/cli/claude/lightcone/hooks/langfuse_prepare_commit_msg.py +142 -0
  9. lightcone/cli/claude/lightcone/hooks/langfuse_session_init_hook.py +83 -0
  10. lightcone/cli/claude/lightcone/hooks/langfuse_utils.py +457 -0
  11. lightcone/cli/claude/lightcone/scripts/activate-venv.sh +44 -0
  12. lightcone/cli/claude/lightcone/scripts/check-lc-run.sh +140 -0
  13. lightcone/cli/claude/lightcone/scripts/session-start.sh +140 -0
  14. lightcone/cli/claude/lightcone/scripts/validate-on-save.sh +77 -0
  15. lightcone/cli/claude/lightcone/skills/lc-build/SKILL.md +92 -0
  16. lightcone/cli/claude/lightcone/skills/lc-build/assets/loop-prompt.md +92 -0
  17. lightcone/cli/claude/lightcone/skills/lc-build/scripts/setup-lc-build.sh +240 -0
  18. lightcone/cli/claude/lightcone/skills/lc-feedback/SKILL.md +94 -0
  19. lightcone/cli/claude/lightcone/skills/lc-migrate/SKILL.md +98 -0
  20. lightcone/cli/claude/lightcone/skills/lc-new/SKILL.md +183 -0
  21. lightcone/cli/claude/lightcone/skills/lc-verify/SKILL.md +53 -0
  22. lightcone/cli/claude/lightcone/templates/CLAUDE.md +32 -0
  23. lightcone/cli/commands.py +2327 -0
  24. lightcone/cli/plugin.py +34 -0
  25. lightcone/engine/__init__.py +42 -0
  26. lightcone/engine/assets.py +418 -0
  27. lightcone/engine/container.py +370 -0
  28. lightcone/engine/io_manager.py +27 -0
  29. lightcone/engine/runner.py +1017 -0
  30. lightcone/engine/site_registry.py +142 -0
  31. lightcone/engine/status.py +135 -0
  32. lightcone/engine/targets.py +68 -0
  33. lightcone/engine/tree.py +245 -0
  34. lightcone/eval/__init__.py +25 -0
  35. lightcone/eval/build.py +148 -0
  36. lightcone/eval/cli.py +176 -0
  37. lightcone/eval/graders.py +192 -0
  38. lightcone/eval/harness.py +265 -0
  39. lightcone/eval/models.py +117 -0
  40. lightcone/eval/report.py +214 -0
  41. lightcone/eval/sandbox.py +394 -0
  42. lightcone_cli-0.2.0.dist-info/METADATA +16 -0
  43. lightcone_cli-0.2.0.dist-info/RECORD +46 -0
  44. lightcone_cli-0.2.0.dist-info/WHEEL +4 -0
  45. lightcone_cli-0.2.0.dist-info/entry_points.txt +2 -0
  46. lightcone_cli-0.2.0.dist-info/licenses/LICENSE +29 -0
@@ -0,0 +1,16 @@
1
+ """lightcone-cli — the command-line surface for the Lightcone toolchain."""
2
+
3
+ from __future__ import annotations
4
+
5
+ try:
6
+ from importlib.metadata import version
7
+
8
+ __version__ = version("lightcone-cli")
9
+ except Exception:
10
+ __version__ = "0.0.0.dev"
11
+
12
+
13
+ def main() -> None:
14
+ from lightcone.cli.commands import main as _main
15
+
16
+ _main()
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: lc-extractor
3
+ description: Extract prior insights from scientific papers for ASTRA analyses. Reads PDFs, identifies claims relevant to target decisions, extracts verbatim quotes, and verifies them. Use for literature extraction during /lc-new.
4
+ tools: Read, Bash
5
+ ---
6
+
7
+ You are an ASTRA prior insight extraction agent with self-validation capability. Your task is to extract prior insights from a single paper and format them for an ASTRA analysis. Prior insights are knowledge from literature that informs analysis decisions — they go in the `prior_insights:` section of astra.yaml.
8
+
9
+ ## Analysis Context
10
+
11
+ [ANALYSIS_CONTEXT -- paste the analysis summary: problem statement, relevant decisions needing evidence, and what kind of support would be most useful]
12
+
13
+ ## Your Paper
14
+
15
+ - DOI: [DOI]
16
+ - Version: [VERSION -- include only for arXiv papers, omit this line otherwise]
17
+ - PDF Path: [PDF_PATH -- absolute path from `astra paper path`]
18
+ - Target decisions: [TARGET_DECISIONS -- list each decision ID, its label, and its options with descriptions]
19
+
20
+ ## Instructions
21
+
22
+ 1. Read the PDF at the path above using the Read tool.
23
+ 2. Identify claims relevant to the target decisions.
24
+ 3. For each relevant claim, extract:
25
+ - A clear claim (1-2 sentences stating what we learned)
26
+ - An exact quote from the paper (verbatim, 1-3 sentences)
27
+ - The page number where the quote appears (as a hint)
28
+ - Prefix and suffix context (~20-100 chars each) for robust matching
29
+ 4. Validate all quotes using batch verification (see below).
30
+ 5. Return ONLY verified prior insights as YAML.
31
+
32
+ ## Batch Verification Loop
33
+
34
+ After extracting all quotes from the paper:
35
+
36
+ 1. Build a JSON object with all quotes:
37
+ ```json
38
+ {"quotes": [
39
+ {"text": "exact quote 1", "page": 5, "prefix": "context before", "suffix": "context after"},
40
+ {"text": "exact quote 2", "page": 12, "prefix": "context before", "suffix": "context after"}
41
+ ]}
42
+ ```
43
+
44
+ 2. Run batch verification (extracts PDF text once, verifies all quotes):
45
+ ```bash
46
+ echo '<json>' | astra paper verify-quotes "[DOI]" [--version N]
47
+ ```
48
+
49
+ 3. Parse the JSON response. Check each result's `status`: "verified" or "not_found".
50
+
51
+ 4. For any "not_found" quotes: re-read the relevant PDF section, correct the quote text, prefix, and suffix.
52
+
53
+ 5. Repeat batch verification with corrected quotes (max 3 iterations).
54
+
55
+ 6. If still failing after 3 attempts, drop those quotes and note which ones could not be verified.
56
+
57
+ ## Output Format
58
+
59
+ Return ONLY this YAML structure. Do not include any other text outside the YAML block.
60
+
61
+ ```yaml
62
+ prior_insights:
63
+ <insight_id>:
64
+ id: <insight_id>
65
+ claim: "<What we learned from this paper>"
66
+ created_at: "[TIMESTAMP]"
67
+ evidence:
68
+ - id: ev1
69
+ doi: "[DOI]"
70
+ version: <version if arXiv, omit otherwise>
71
+ quote:
72
+ type: TextQuoteSelector
73
+ exact: "<VERIFIED exact quote from paper>"
74
+ prefix: "<~20-100 chars BEFORE the quote>"
75
+ suffix: "<~20-100 chars AFTER the quote>"
76
+ location:
77
+ type: FragmentSelector
78
+ page: <page number hint>
79
+ scope: "<when this applies -- optional, include only if the claim has limited applicability>"
80
+
81
+ decision_links:
82
+ <decision_id>:
83
+ <option_id>:
84
+ - <insight_id>
85
+
86
+ verification_summary:
87
+ total_quotes: <N>
88
+ verified: <N>
89
+ failed: <N>
90
+ failed_details: "<description of any quotes that could not be verified, or 'none'>"
91
+ ```
92
+
93
+ ## Rules
94
+
95
+ - Use lowercase_with_underscores for insight IDs
96
+ - Quotes must be EXACT -- copy verbatim from the PDF
97
+ - One claim per insight -- do not combine multiple claims
98
+ - Only extract insights relevant to the target decisions
99
+ - Only include insights whose quotes passed verification
100
+ - If no relevant insights found, return `prior_insights: {}`
101
+ - prefix and suffix are REQUIRED for every TextQuoteSelector
102
+ - For arXiv papers, always include the version field in evidence
103
+
104
+ ## Troubleshooting: Verification Failures
105
+
106
+ | Failure | Cause | Fix |
107
+ |---------|-------|-----|
108
+ | `Quote not found` | Paraphrased or introduced typos | Re-read the PDF page, copy the exact text, re-verify |
109
+ | `Paper not in cache` | Paper was not downloaded before validation | Run `astra paper add <doi>` |
110
+ | `Wrong page` | Page number is incorrect (quote exists elsewhere) | Check `found_pages` in JSON output, update page number |
111
+ | `prefix/suffix mismatch` | Context text does not match surrounding text | Re-read the area around the quote, copy exact surrounding text |
112
+ | Persistent `not_found` | OCR artifacts, ligatures, or Unicode differences | Try shorter quote avoiding problem characters; increase prefix/suffix |
113
+
114
+ **Recovery**: Re-read the failing page, copy the exact text, update prefix/suffix, verify with `astra paper verify-quote`, then run `astra validate astra.yaml --verify-evidence`.
@@ -0,0 +1,290 @@
1
+ # ASTRA Reference
2
+
3
+ ## What an ASTRA Analysis Is
4
+
5
+ An ASTRA analysis is a structured layer between the code and the paper. It surfaces the inputs a computation depends on, the outputs it produces, and -- critically -- every methodological decision that could plausibly affect the results. The goal is to make the full decision space explicit and machine-readable, so that alternative defensible choices can be systematically explored rather than silently baked in.
6
+
7
+ An `astra.yaml` spec captures this for a single unit of work. The structure is **self-similar**: a top-level analysis and a nested sub-analysis have exactly the same shape. Everything in this reference applies equally to both.
8
+
9
+ ## astra.yaml Structure
10
+
11
+ Fields: `name`, `description`, `version`, `authors`, `tags`, `inputs`, `outputs`, `decisions`, `prior_insights`, `findings`, `analyses`, `container`.
12
+
13
+ ```yaml
14
+ # Simple analysis -- everything at top level
15
+ version: "1.0"
16
+ name: "My Analysis"
17
+ description: "What this analysis investigates."
18
+ inputs:
19
+ - id: training_data
20
+ type: data
21
+ source: "data/train.csv"
22
+ decisions:
23
+ scaling:
24
+ label: "Feature Scaling"
25
+ tags: [preprocessing] # optional freeform tags for grouping
26
+ rationale: "Affects convergence"
27
+ default: standard
28
+ options:
29
+ standard: { label: "StandardScaler" }
30
+ minmax: { label: "MinMaxScaler" }
31
+ use_pca:
32
+ label: "Use PCA"
33
+ default: "no"
34
+ options:
35
+ "yes": { label: "Yes" }
36
+ "no": { label: "No" }
37
+ n_components:
38
+ label: "PCA Components"
39
+ default: "50"
40
+ options:
41
+ "50": { label: "50 components" }
42
+ "100": { label: "100 components" }
43
+ outputs:
44
+ - id: accuracy
45
+ type: metric
46
+ recipe:
47
+ command: python scripts/evaluate.py
48
+ container: Containerfile
49
+ ```
50
+
51
+ ## Decisions
52
+
53
+ A decision is a methodological choice where a different defensible option could plausibly produce a different numerical result. Include it if changing the choice could shift a quantitative outcome -- even modestly. Many small decisions can compound. When in doubt, include it.
54
+
55
+ **Not decisions -- skip these:**
56
+
57
+ - **Tooling choices** that produce identical numerical results: programming language, library/framework (PyTorch vs TensorFlow), file format, parallelization strategy, plotting style.
58
+ - **Fixed constraints** with no degrees of freedom: "use the data that exists," "satisfy the grant requirements."
59
+ - **What to produce** -- decisions control *how* something is computed, not *what* outputs exist. Outputs are fixed by the analysis structure.
60
+
61
+ **These ARE decisions -- do not skip:**
62
+
63
+ - Algorithmic choices (MCMC vs optimization, KDE vs histogram, smoothing method)
64
+ - Numerical parameters and thresholds (sigma clipping level, bin width, convergence criterion, iteration count)
65
+ - Statistical method choices (bootstrap vs analytic errors, Bayesian vs frequentist)
66
+ - Data selection criteria (quality cuts, magnitude limits, spatial boundaries)
67
+ - Correction and calibration choices (which reddening law, which zero-point, which prior)
68
+
69
+ ### Parameterization
70
+
71
+ **Every decision must be parameterized in code** -- never hardcode a decision value. Accept all decisions as CLI args.
72
+
73
+ **Underscore convention:** IDs use underscores in `astra.yaml` (`prior_range`). lightcone-cli passes `--prior_range wide`. Scripts must match: `parser.add_argument('--prior_range')`, **not** `--prior-range`.
74
+
75
+ ### Constraints
76
+
77
+ - `when: "decision.option"` -- decision only exists given an upstream choice (e.g., `svm_kernel` only exists `when: model.svm`)
78
+ - `incompatible_with: ["decision.option"]` -- cannot coexist in a universe
79
+ - `requires: ["decision.option"]` -- must be selected together
80
+ - `excluded: true` + `excluded_reason: "..."` -- option considered but rejected (cannot be default or selected)
81
+
82
+ ## Writing Results
83
+
84
+ Convention path: `results/<universe_id>/<output_id>.<ext>` -- no `path` field needed.
85
+
86
+ - `metric` -- JSON (`{"value": 0.95}`)
87
+ - `figure` -- PNG
88
+ - `table` -- CSV
89
+ - `data` -- Parquet/HDF5
90
+ - `report` -- Markdown
91
+
92
+ ## Recipe Format
93
+
94
+ Inline on outputs. Fields: `command` (required), `inputs`, `container`, `resources`.
95
+
96
+ ```yaml
97
+ outputs:
98
+ - id: accuracy
99
+ type: metric
100
+ recipe:
101
+ command: python scripts/evaluate.py
102
+ inputs: [trained_model] # Dependency on other output
103
+ container: ghcr.io/proj/ml:latest # Overrides analysis-level default
104
+ resources: { cpus: 4, memory: "32GB", gpus: 1, time_limit: "2h" }
105
+ ```
106
+
107
+ Set `container:` at analysis level (all recipes inherit); per-recipe `container:` overrides. Pass either a container image name (e.g., `python:3.12-slim`, `ghcr.io/org/img:latest`) or a path to a Containerfile (e.g., `Containerfile`, `containers/Dockerfile`). The runtime figures out whether to pull or build.
108
+
109
+ ### Conditional Outputs
110
+
111
+ Outputs can have `when` conditions -- the output only exists when the condition is met for a given universe. Uses the same syntax as decision `when` (negation with `~`, lists AND'd).
112
+
113
+ ```yaml
114
+ outputs:
115
+ - id: faint_metrics
116
+ type: metric
117
+ when: "~training_sample.bright_only" # Only when NOT bright_only
118
+ recipe: { command: python scripts/evaluate.py }
119
+ - id: combined_report
120
+ type: report
121
+ when: ["~training_sample.bright_only", model.svm] # AND: both must be true
122
+ recipe: { command: python scripts/combo.py }
123
+ ```
124
+
125
+ ## Universe Management
126
+
127
+ A universe selects one option per decision -- a defensible alternative analysis path. Bug fixes and refactors are normal commits, not universes.
128
+
129
+ ```bash
130
+ astra universe generate -n experiment1 -d "Testing hypothesis X"
131
+ # Edit universes/experiment1.yaml, then: lc run --universe experiment1
132
+ ```
133
+
134
+ **Adding a new decision:** (1) add to `astra.yaml` with options/default/rationale, (2) add parameter to code, (3) add to all existing universe files with default, (4) create new universe, (5) `astra validate astra.yaml`.
135
+
136
+ ## Prior Insights and Findings
137
+
138
+ Two kinds of insight, distinguished by direction:
139
+
140
+ - **Prior insights** (`prior_insights:`) — knowledge from outside the analysis that informs decisions. From literature (by DOI) or artifacts from a prior/parent analysis.
141
+ - **Findings** (`findings:`) — conclusions from the analysis itself, backed by its own output artifacts.
142
+
143
+ Both use the same model (id, claim, created_at, evidence). Placement determines direction.
144
+
145
+ ```yaml
146
+ prior_insights:
147
+ layer_norm_stability:
148
+ id: layer_norm_stability
149
+ claim: "Layer normalization improves training stability"
150
+ created_at: "2025-01-15T10:30:00"
151
+ evidence:
152
+ - id: e1
153
+ doi: "10.48550/arXiv.1607.06450"
154
+ quote: { type: TextQuoteSelector, exact: "Exact text", prefix: "~20-100 chars before", suffix: "~20-100 chars after" }
155
+ location: { type: FragmentSelector, page: 5 }
156
+ - id: e2
157
+ doi: "10.48550/arXiv.1607.06450"
158
+ figure: { type: FigureSelector, label: "Figure 3a", caption: "..." }
159
+ scope: "Context where this applies (optional)"
160
+
161
+ findings:
162
+ scaling_result:
163
+ id: scaling_result
164
+ claim: "StandardScaler achieves 97% accuracy vs 91% for MinMaxScaler"
165
+ created_at: "2025-02-01T14:00:00"
166
+ evidence:
167
+ - id: e1
168
+ artifact: "accuracy" # Content selectors optional for artifacts
169
+ - id: e2
170
+ artifact: "model_comparison"
171
+ quote: { type: TextQuoteSelector, exact: "StandardScaler achieved 97% accuracy vs 91% for MinMaxScaler" }
172
+ ```
173
+
174
+ Link prior insights to decisions: `options: { layer_norm: { insights: [layer_norm_stability] } }`
175
+
176
+ Artifact references are validated against declared outputs — `astra validate` flags any `artifact:` that doesn't match an output ID. Literature evidence requires at least one content selector (quote, figure, or table); artifact evidence does not.
177
+
178
+ **Sub-analysis findings as prior insights:** When a sub-analysis explores a specific question (calibration study, simulation validation, sensitivity test), its findings can inform decisions elsewhere. The parent or sibling references the sub-analysis output as artifact evidence in its own `prior_insights`, e.g. `artifact: "build_mocks.noise_diagnostics"`. This creates a traceable chain from sub-analysis conclusion to downstream decision.
179
+
180
+ ## Sub-Analyses
181
+
182
+ ### What a Sub-Analysis Is
183
+
184
+ Each `astra.yaml` -- root or nested -- represents a **unit of work**: meaningful inputs, methodological decisions, meaningful outputs. A sub-analysis is one of these units nested inside a larger analysis. It can be understood, executed, and evaluated on its own terms.
185
+
186
+ ### When to Split
187
+
188
+ Default to a **single analysis**. Split into sub-analyses only when:
189
+
190
+ - **Decision ownership** -- the stage has its own decisions that could meaningfully vary, clearly scoped to that stage rather than the broader analysis. Shared decisions live at the parent (`from: ../`); stage-specific decisions live in the sub-analysis. If you can't cleanly assign decisions to levels, the split is probably wrong.
191
+ - **Reusability** -- someone working on a different paper could use this stage's output as-is (a cleaned catalog, a trained emulator, a set of mocks).
192
+ - **Side quests** -- independent investigations (diagnostics, calibrations, simulation studies) that have different inputs/outputs/code from the main analysis are sub-analyses, not universes. Universes are different parameter choices on the same pipeline.
193
+ - **If boundaries are unclear**, start flat and split later when they become explicit: separate stage outputs, explicit `from` links, clear decision ownership per level.
194
+
195
+ ### Worked Examples
196
+
197
+ #### Two-Stage Pipeline (DAG Split)
198
+
199
+ A paper builds mock galaxy catalogs, then trains a neural network on them for photometric redshift estimation. Natural split:
200
+ - **`build_mocks`**: simulation inputs + survey properties, decisions about noise model and selection function. Produces mock catalogs.
201
+ - **`photo_z`**: mocks (from sibling) + real survey data, decisions about network architecture and training. Produces redshift estimates.
202
+
203
+ The mock-building decisions are independent from training decisions. Someone could reuse the mocks for a different estimator.
204
+
205
+ #### When NOT to Split
206
+
207
+ A paper downloads galaxies, applies quality cuts, corrects for extinction, computes luminosity functions, fits a Schechter function. Five steps -- but one objective, shared decisions, one end product.
208
+
209
+ ### Anti-Patterns
210
+
211
+ - **Splitting by script** rather than by analytical unit.
212
+ - **Zero-decision sub-analyses** that just pass data through -- make these output recipes in the parent.
213
+ - **Premature splitting.** Start flat, split when boundaries become explicit. Easier to split a working flat analysis than merge a broken hierarchical one.
214
+ - **Forcing a linear DAG.** Independent stages don't need to be wired in sequence just because the paper presents them that way.
215
+
216
+ ### Composition Mechanics
217
+
218
+ Each sub-analysis lives in its own directory with its own `astra.yaml`. The parent lists them with `path:` references:
219
+
220
+ ```yaml
221
+ # Root astra.yaml
222
+ inputs:
223
+ - id: survey_catalog
224
+ type: data
225
+ source: "data/survey.parquet"
226
+ decisions:
227
+ cosmology_model: # Shared across stages
228
+ label: "Cosmological Model"
229
+ tags: [physics]
230
+ default: flat_lcdm
231
+ options:
232
+ flat_lcdm: { label: "Flat LCDM" }
233
+ wcdm: { label: "wCDM" }
234
+ outputs:
235
+ - id: trained_model
236
+ type: data
237
+ from: train_network.trained_model # Alias -- produced by sub-analysis
238
+ analyses:
239
+ build_mocks:
240
+ path: ./analyses/build_mocks
241
+ train_network:
242
+ path: ./analyses/train_network
243
+ ```
244
+
245
+ Inside each sub-analysis's own `astra.yaml`, `from:` wires inputs and decisions to the parent or siblings:
246
+
247
+ ```yaml
248
+ # analyses/train_network/astra.yaml
249
+ inputs:
250
+ - id: training_data
251
+ type: data
252
+ from: build_mocks.mock_catalog # Sibling output
253
+ outputs:
254
+ - id: trained_model
255
+ type: data
256
+ recipe: { command: python src/train.py, resources: { gpus: 1, memory: "32GB" } }
257
+ decisions:
258
+ cosmology_model:
259
+ from: ../cosmology_model # Inherit parent decision
260
+ noise_model:
261
+ label: "Noise Model"
262
+ default: heteroscedastic
263
+ options:
264
+ homoscedastic: { label: "Homoscedastic" }
265
+ heteroscedastic: { label: "Heteroscedastic" }
266
+ ```
267
+
268
+ **Wiring patterns:**
269
+ - **Input `from:`** -- `from: parent_input_id` (parent input) or `from: sibling_id.output_id` (sibling output).
270
+ - **Decision `from: ../parent_id`** -- inherits a parent decision. The sub-analysis uses the parent's value; do not set it in the sub-analysis universe.
271
+ - **Output `from: sub.output`** at root level creates an alias to a sub-analysis output.
272
+ - **`universe:` field** in universe files selects which sub-analysis universe to load: `build_mocks: { universe: baseline }` loads `./analyses/build_mocks/universes/baseline.yaml`.
273
+
274
+ ## CLI Reference (astra)
275
+
276
+ ```bash
277
+ astra validate astra.yaml # Validate (run after every change)
278
+ astra validate astra.yaml --verify-evidence # + verify insight quotes against PDFs
279
+ astra info [--decisions] # Analysis summary / decision details
280
+ astra universe generate -n NAME [-d "desc"] # Generate universe from defaults
281
+ astra universe check universes/x.yaml # Check universe constraints
282
+ astra viz # Visualize decision space
283
+ astra schema show analysis # Show JSON schema
284
+ ```
285
+
286
+ ## Validation
287
+
288
+ Run `astra validate astra.yaml` after **every** spec change. Additional checks:
289
+ - Universe files: `astra universe check universes/<name>.yaml`
290
+ - Evidence quotes: `astra validate astra.yaml --verify-evidence`
@@ -0,0 +1,75 @@
1
+ # lightcone-cli Reference
2
+
3
+ Reference for lightcone-cli execution: CLI commands, development workflow, status interpretation, HPC execution, and failure diagnosis. For astra.yaml spec syntax, see `astra-reference.md`.
4
+
5
+ ## CLI Reference
6
+
7
+ ```bash
8
+ lc init [DIR] # Scaffold a new ASTRA project
9
+ lc init NAME --sub-analysis # Scaffold sub-analysis and wire into parent
10
+ lc run [OUTPUT] [--universe NAME] # Execute recipes via Dagster (auto-builds)
11
+ lc run --partition gpu --qos shared # Unknown flags passed through to SLURM
12
+ lc run --no-build # Skip automatic container builds
13
+ lc build [--force] [--runtime docker] # Build container images from specs
14
+ lc status [--universe NAME] # Materialization + container status
15
+ lc dev [--port 3000] # Dagster webserver UI
16
+ lc target [--set NAME] [--list] # Manage execution targets
17
+ lc setup # Interactive target setup wizard
18
+ ```
19
+
20
+ ## Creating Sub-Analyses
21
+
22
+ `lc init NAME --sub-analysis` scaffolds a sub-analysis and wires it into the parent project. It:
23
+
24
+ 1. Creates `analyses/<name>/` with its own `astra.yaml`, `CLAUDE.md`, `scripts/`, `universes/baseline.yaml`, and `results/`
25
+ 2. Adds a `path:` entry to the parent `astra.yaml` under `analyses:`
26
+ 3. Adds a `universe: baseline` entry to all existing parent universe files
27
+
28
+ After scaffolding, populate the sub-analysis's `astra.yaml` with inputs, outputs, and decisions. Use `from:` references to wire inputs and decisions to the parent or siblings — see `astra-reference.md` under "Composition Mechanics."
29
+
30
+ ## Development Workflow
31
+
32
+ Three overlapping phases:
33
+
34
+ 1. **Write & Debug** -- Run scripts directly (`python scripts/compute.py`) to iterate. Write them recipe-ready from the start: parameterize decisions, write to convention paths, one script per output.
35
+ 2. **Integrate** -- Add `recipe:` blocks to outputs in `astra.yaml`. Track with `lc status` (`no recipe` / `pending` / `ok`). Set `container:` at analysis level or per-recipe — pass an image name (e.g., `python:3.12-slim`) or a path to a Containerfile (e.g., `Containerfile`).
36
+ 3. **Materialize** -- `lc run` executes via Dagster in containers (Docker or SLURM). Falls back to local execution if Docker is unavailable. Done when `lc status` shows all `ok`.
37
+
38
+ **An output is not done until `lc run` produces it.** Running scripts directly is for debugging only — final results must always come from `lc run` so they are reproducible inside containers.
39
+
40
+ ### Spec-Code Invariant
41
+
42
+ **`astra.yaml` must always reflect the code and vice versa.** When you change one, update the other immediately:
43
+ - Add a decision to code? Add it to `astra.yaml` and all universe files.
44
+ - Add an output or change a script? Update the `recipe:` block in `astra.yaml`.
45
+ - Remove or rename something? Update both sides and run `astra validate astra.yaml`.
46
+
47
+ ## Status Interpretation
48
+
49
+ `lc status` shows outputs vs universes. **Progression:** `no recipe` --> `pending` --> `ok`
50
+
51
+ - `ok` -- Recipe exists, results on disk. Done.
52
+ - `pending` -- Recipe exists, not materialized. Run `lc run`.
53
+ - `no recipe` -- No `recipe:` block yet. Still in Write & Debug phase.
54
+
55
+ Container status: `prebuilt: image`, `build: Containerfile (built)`, or `(not built)` (needs `lc build`).
56
+
57
+ ## Failure Diagnosis
58
+
59
+ - **Script arg not recognized** -- Use underscores in argparse to match decision IDs
60
+ - **Recipe input not found** -- Materialize upstream outputs first
61
+
62
+ After failure: fix, then `lc run <output_id> --universe <name>`.
63
+
64
+ ## HPC / Interactive Execution
65
+
66
+ If `SLURM_JOB_ID` is set in the environment, `lc run` automatically uses `srun` (instant) instead of `sbatch` (queued). This means the user is inside an interactive allocation and execution will be fast.
67
+
68
+ If `SLURM_JOB_ID` is not set and the target is SLURM, `lc run` submits via `sbatch`. Any unknown flags are passed through as SLURM directives:
69
+ ```bash
70
+ lc run --qos shared --constraint gpu # NERSC
71
+ lc run --partition gpu-a100 # TACC, SDSC, etc.
72
+ lc run --gres=gpu:4 --partition batch # any cluster
73
+ ```
74
+
75
+ Recipe `resources` (gpus, memory, cpus, time_limit) are portable and used for batch scheduling. They are ignored in interactive mode since the allocation already provides them.
@@ -0,0 +1,86 @@
1
+ # Lightcone UI Brand
2
+
3
+ Visual patterns for user-facing lightcone-cli output. Skills reference this file for consistent formatting.
4
+
5
+ The principle: use markdown idiomatically. Minimal Unicode decoration. Let the content breathe.
6
+
7
+ ## Stage Banners
8
+
9
+ Use for major phase transitions. A markdown `###` heading.
10
+
11
+ ```
12
+ ### Research Question
13
+ ```
14
+
15
+ **Stage names:**
16
+ - `Research Question`
17
+ - `Analysis Structure`
18
+ - `Deep Dive — [Section]`
19
+ - `Finalizing`
20
+ - `Specification Complete`
21
+ - `Verify — <universe_id>`
22
+ - `Verification Report — <universe_id>`
23
+ - `Project Discovery`
24
+ - `Inventory`
25
+ - `Scaffolding`
26
+ - `Migration Plan`
27
+ - `Migration Complete`
28
+
29
+ ---
30
+
31
+ ## Status Symbols
32
+
33
+ ```
34
+ ✓ Complete / Passed
35
+ ○ Pending
36
+ ✗ Failed
37
+ ```
38
+
39
+ ---
40
+
41
+ ## Action Prompts
42
+
43
+ When user input is needed, use bold text:
44
+
45
+ ```
46
+ **What are you trying to learn? Describe the research question in your own words.**
47
+ ```
48
+
49
+ No boxes, no rules, no blockquotes (those render grey/dimmed).
50
+
51
+ ---
52
+
53
+ ## Next Up Block
54
+
55
+ At end of major completions:
56
+
57
+ ```
58
+ ---
59
+ **Next up**
60
+
61
+ **{Description}** — {one-line detail}
62
+
63
+ `{copy-paste command}`
64
+
65
+ Also available: `/lc-verify`, ...
66
+ ```
67
+
68
+ ---
69
+
70
+ ## Tables
71
+
72
+ ```
73
+ | Section | Decisions | Outputs |
74
+ |---------|-----------|---------|
75
+ | main | 3 | 2 |
76
+ ```
77
+
78
+ ---
79
+
80
+ ## Anti-Patterns
81
+
82
+ - Heavy Unicode box-drawing (━, ─── rules, ► arrows)
83
+ - Boxing prompts in horizontal rules
84
+ - Random emoji
85
+ - Walls of decoration that distract from content
86
+ - Missing Next Up block after completions