lightcone-cli 0.2.0__tar.gz
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.
- lightcone_cli-0.2.0/.gitignore +215 -0
- lightcone_cli-0.2.0/LICENSE +29 -0
- lightcone_cli-0.2.0/PKG-INFO +16 -0
- lightcone_cli-0.2.0/claude/lightcone/agents/lc-extractor.md +114 -0
- lightcone_cli-0.2.0/claude/lightcone/guides/astra-reference.md +290 -0
- lightcone_cli-0.2.0/claude/lightcone/guides/lightcone-cli-reference.md +75 -0
- lightcone_cli-0.2.0/claude/lightcone/guides/ui-brand.md +86 -0
- lightcone_cli-0.2.0/claude/lightcone/hooks/langfuse_git_commit_hook.py +303 -0
- lightcone_cli-0.2.0/claude/lightcone/hooks/langfuse_hook.py +894 -0
- lightcone_cli-0.2.0/claude/lightcone/hooks/langfuse_prepare_commit_msg.py +142 -0
- lightcone_cli-0.2.0/claude/lightcone/hooks/langfuse_session_init_hook.py +83 -0
- lightcone_cli-0.2.0/claude/lightcone/hooks/langfuse_utils.py +457 -0
- lightcone_cli-0.2.0/claude/lightcone/scripts/activate-venv.sh +44 -0
- lightcone_cli-0.2.0/claude/lightcone/scripts/check-lc-run.sh +140 -0
- lightcone_cli-0.2.0/claude/lightcone/scripts/session-start.sh +140 -0
- lightcone_cli-0.2.0/claude/lightcone/scripts/validate-on-save.sh +77 -0
- lightcone_cli-0.2.0/claude/lightcone/skills/lc-build/SKILL.md +92 -0
- lightcone_cli-0.2.0/claude/lightcone/skills/lc-build/assets/loop-prompt.md +92 -0
- lightcone_cli-0.2.0/claude/lightcone/skills/lc-build/scripts/setup-lc-build.sh +240 -0
- lightcone_cli-0.2.0/claude/lightcone/skills/lc-feedback/SKILL.md +94 -0
- lightcone_cli-0.2.0/claude/lightcone/skills/lc-migrate/SKILL.md +98 -0
- lightcone_cli-0.2.0/claude/lightcone/skills/lc-new/SKILL.md +183 -0
- lightcone_cli-0.2.0/claude/lightcone/skills/lc-verify/SKILL.md +53 -0
- lightcone_cli-0.2.0/claude/lightcone/templates/CLAUDE.md +32 -0
- lightcone_cli-0.2.0/pyproject.toml +77 -0
- lightcone_cli-0.2.0/src/lightcone/cli/__init__.py +16 -0
- lightcone_cli-0.2.0/src/lightcone/cli/commands.py +2327 -0
- lightcone_cli-0.2.0/src/lightcone/cli/plugin.py +34 -0
- lightcone_cli-0.2.0/src/lightcone/engine/__init__.py +42 -0
- lightcone_cli-0.2.0/src/lightcone/engine/assets.py +418 -0
- lightcone_cli-0.2.0/src/lightcone/engine/container.py +370 -0
- lightcone_cli-0.2.0/src/lightcone/engine/io_manager.py +27 -0
- lightcone_cli-0.2.0/src/lightcone/engine/runner.py +1017 -0
- lightcone_cli-0.2.0/src/lightcone/engine/site_registry.py +142 -0
- lightcone_cli-0.2.0/src/lightcone/engine/status.py +135 -0
- lightcone_cli-0.2.0/src/lightcone/engine/targets.py +68 -0
- lightcone_cli-0.2.0/src/lightcone/engine/tree.py +245 -0
- lightcone_cli-0.2.0/src/lightcone/eval/__init__.py +25 -0
- lightcone_cli-0.2.0/src/lightcone/eval/build.py +148 -0
- lightcone_cli-0.2.0/src/lightcone/eval/cli.py +176 -0
- lightcone_cli-0.2.0/src/lightcone/eval/graders.py +192 -0
- lightcone_cli-0.2.0/src/lightcone/eval/harness.py +265 -0
- lightcone_cli-0.2.0/src/lightcone/eval/models.py +117 -0
- lightcone_cli-0.2.0/src/lightcone/eval/report.py +214 -0
- lightcone_cli-0.2.0/src/lightcone/eval/sandbox.py +394 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.envrc
|
|
140
|
+
.venv
|
|
141
|
+
env/
|
|
142
|
+
venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm
|
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
176
|
+
#.idea/
|
|
177
|
+
|
|
178
|
+
# Abstra
|
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
181
|
+
# Learn more at https://abstra.io/docs
|
|
182
|
+
.abstra/
|
|
183
|
+
|
|
184
|
+
# Visual Studio Code
|
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
189
|
+
# .vscode/
|
|
190
|
+
|
|
191
|
+
# Ruff stuff:
|
|
192
|
+
.ruff_cache/
|
|
193
|
+
|
|
194
|
+
# PyPI configuration file
|
|
195
|
+
.pypirc
|
|
196
|
+
|
|
197
|
+
# Cursor
|
|
198
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
199
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
200
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
201
|
+
.cursorignore
|
|
202
|
+
.cursorindexingignore
|
|
203
|
+
|
|
204
|
+
# Marimo
|
|
205
|
+
marimo/_static/
|
|
206
|
+
marimo/_lsp/
|
|
207
|
+
__marimo__/
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
dev
|
|
211
|
+
eval-results
|
|
212
|
+
|
|
213
|
+
# UV
|
|
214
|
+
## lockfile should be versioned for applications but not for libraries
|
|
215
|
+
uv.lock
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Centre National de la Recherche Scientifique (CNRS) and
|
|
4
|
+
The Regents of the University of California
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: lightcone-cli
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Lightcone command-line toolchain
|
|
5
|
+
Author: Lightcone Research
|
|
6
|
+
License: BSD-3-Clause
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: >=3.11
|
|
9
|
+
Requires-Dist: astra-tools>=0.2.2
|
|
10
|
+
Requires-Dist: click>=8.0
|
|
11
|
+
Requires-Dist: dagster-docker>=0.25
|
|
12
|
+
Requires-Dist: dagster-webserver>=1.9
|
|
13
|
+
Requires-Dist: dagster>=1.9
|
|
14
|
+
Requires-Dist: langfuse>=2.0
|
|
15
|
+
Requires-Dist: pyyaml>=6.0
|
|
16
|
+
Requires-Dist: rich>=13.0
|
|
@@ -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`
|