Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,28 @@ on:
push:
branches-ignore: [main]

permissions:
contents: read

jobs:
test:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 22.22.2
cache: pnpm
cache-dependency-path: |
pnpm-lock.yaml
site/pnpm-lock.yaml
- run: pnpm install --frozen-lockfile
- run: pnpm test
- run: pnpm --dir site install --frozen-lockfile --ignore-scripts
- run: pnpm --dir site build
- run: test -f site/build/index.html -a -f site/build/configuration.html -a -f site/build/recordings/casts.js
- run: test -z "$(git ls-files site/build docs)"
52 changes: 52 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Deploy landing page

on:
push:
branches: [main]
paths:
- site/**
- .github/workflows/pages.yml
workflow_dispatch:

permissions:
contents: read

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 22.22.2
cache: pnpm
cache-dependency-path: site/pnpm-lock.yaml
- run: pnpm --dir site install --frozen-lockfile --ignore-scripts
- run: pnpm --dir site build
- uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
- uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
path: site/build

deploy:
needs: build
timeout-minutes: 10
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ node_modules/
# AI-generated image artefacts (should not be committed)
gpt-image-*.png
nano-banana-*.png

# Generated site output
/site/build/
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# pi-autoresearch
### Autonomous experiment loop for pi
**[Install](#install)** · **[Usage](#usage)** · **[How it works](#how-it-works)**
**[Website](https://davebcn87.github.io/pi-autoresearch/)** · **[Documentation](https://davebcn87.github.io/pi-autoresearch/configuration.html)** · **[Install](#install)** · **[Usage](#usage)** · **[How it works](#how-it-works)**

</div>

Expand Down Expand Up @@ -358,6 +358,14 @@ Drop executable scripts in `.auto/hooks/` to run code at iteration boundaries. H
1. **Install pi** — follow the instructions at [pi.dev](https://pi.dev/)
2. **An API key** for your preferred LLM provider (configured in pi)

## Security and trust

Pi packages run with your full user permissions. Review this repository before installing it, and run autoresearch in a dedicated branch or worktree with a clean working tree.

Autoresearch intentionally edits files, creates and reverts commits, and executes the commands in `.auto/measure.sh`, `.auto/checks.sh`, and `.auto/hooks/`. Treat those files as executable code: review them before each session, keep credentials and sensitive files out of scope, and use a sandbox or restricted environment for untrusted projects.

For reproducible installs, pin a version you have reviewed, for example `pi install npm:pi-autoresearch@1.7.0`. Published npm releases include provenance attestations.

## Controlling costs

Autoresearch loops run autonomously and can burn through tokens. Two ways to cap spend:
Expand Down
17 changes: 17 additions & 0 deletions THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Third-party notices

## Published performance results

The landing page cites performance results published in [“Autoresearch isn't just for training models”](https://shopify.engineering/autoresearch). “Shopify” and “Polaris” are used only to identify that public source. Shopify and Polaris names and marks remain the property of their respective owners. This project is not an official Shopify product.

## Public quotations

Short excerpts from public posts on X are reproduced with author attribution and links to the originals. Copyright in those posts remains with their respective authors. Official embeds are loaded only after visitor consent and are isolated in sandboxed, cross-origin frames.

## Asciinema Player

The deployed landing page includes Asciinema Player under the Apache License 2.0. Its license is copied to `site/build/vendor/asciinema-player.LICENSE` during the site build. The generated `site/build/` directory is ignored by Git.

## pi

pi-autoresearch is a community extension for pi. References to pi identify compatibility and do not transfer ownership of the pi name or project.
7 changes: 7 additions & 0 deletions site/ASSETS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Landing-page asset provenance

- `og-image.webp` is project-original artwork created for the pi-autoresearch landing page. It contains no third-party logo.
- `social-preview.png` is a project-original composition built from illustrative pi-autoresearch terminal data. The abbreviated commit identifiers and benchmark values are demo data, not identifiers from a private repository.
- `result-share-card.png` is a project-original visualization of the publicly reported Polaris result in [Shopify Engineering's Autoresearch case study](https://shopify.engineering/autoresearch).

Original visual elements are distributed under this repository's MIT license. Shopify and Polaris are referenced descriptively; their names and marks remain the property of their respective owners.
23 changes: 23 additions & 0 deletions site/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Landing page

The landing-page source lives entirely under `site/`:

- `public/` contains static files copied as-is.
- `content/` contains Markdown rendered during the build.
- `templates/` contains generated-page templates.
- `scripts/` contains build-time generators.

Build the deployable site with:

```bash
pnpm --dir site install --frozen-lockfile --ignore-scripts
pnpm --dir site build
```

Output is written to `site/build/`. That directory is disposable, ignored by Git, and deployed by `.github/workflows/pages.yml`.

Preview it locally with:

```bash
python3 -m http.server 4173 --directory site/build
```
120 changes: 120 additions & 0 deletions site/build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import {cpSync, copyFileSync, mkdirSync, readFileSync, rmSync, writeFileSync} from 'node:fs';
import {resolve} from 'node:path';
import MarkdownIt from 'markdown-it';
import markdownItAnchor from 'markdown-it-anchor';

const siteDirectory = import.meta.dirname;
const buildDirectory = resolve(siteDirectory, 'build');
const contentDirectory = resolve(siteDirectory, 'content');
const publicDirectory = resolve(siteDirectory, 'public');
const vendorDirectory = resolve(buildDirectory, 'vendor');
const playerDirectory = resolve(siteDirectory, 'node_modules/asciinema-player/dist/bundle');

prepareBuildDirectory();
copyPublicFiles();
await import('./scripts/generate-casts.mjs');
buildConfigurationPage();
copyPlayerAssets();

function prepareBuildDirectory() {
rmSync(buildDirectory, {recursive: true, force: true});
mkdirSync(buildDirectory, {recursive: true});
}

function copyPublicFiles() {
cpSync(publicDirectory, buildDirectory, {recursive: true});
}

function buildConfigurationPage() {
const source = readFileSync(resolve(contentDirectory, 'configuration.md'), 'utf8');
const {title, intro, body} = parseDocument(source);
const markdown = createMarkdownRenderer();
const headings = sectionHeadings(markdown.parse(body, {}));
const renderedContent = wrapSections(markdown.render(body));
const template = readFileSync(resolve(siteDirectory, 'templates/configuration.html'), 'utf8');
const output = template
.replaceAll('{{title}}', escapeHtml(title))
.replace('{{intro}}', markdown.renderInline(intro))
.replace('{{toc}}', renderTableOfContents(headings))
.replace('{{content}}', renderedContent);
writeFileSync(resolve(buildDirectory, 'configuration.html'), output);
}

function parseDocument(source) {
const lines = source.trim().split('\n');
const title = lines.shift()?.replace(/^#\s+/, '') ?? 'Configuration';
while (lines[0]?.trim() === '') lines.shift();
const firstSection = lines.findIndex((line) => line.startsWith('## '));
const intro = lines.slice(0, firstSection).join('\n').trim();
const body = lines.slice(firstSection).join('\n');
return {title, intro, body};
}

function createMarkdownRenderer() {
return new MarkdownIt({html: false, linkify: true, typographer: true})
.use(markdownItAnchor, {slugify: sectionId});
}

function sectionHeadings(tokens) {
const headings = [];
tokens.forEach((token, index) => {
if (token.type !== 'heading_open' || token.tag !== 'h2') return;
headings.push({id: token.attrGet('id'), text: tokens[index + 1].content});
});
return headings;
}

function sectionId(title) {
const knownIds = {
'Session configuration': 'config-file',
'Session files': 'session-files',
'Runtime options': 'runtime',
'Safety and trust': 'safety',
'Keyboard shortcuts (opt-in)': 'shortcuts',
'Hooks': 'hooks',
'Session controls': 'commands',
'Intentionally fixed behavior': 'fixed',
'Start with the defaults': 'start',
};
return knownIds[title] ?? title.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)/g, '');
}

function wrapSections(content) {
let sectionCount = 0;
const wrapped = content.replace(/<h2 id="([^"]+)"[^>]*>([\s\S]*?)<\/h2>/g, (_match, id, heading) => {
const closePrevious = sectionCount > 0 ? '</section>' : '';
sectionCount += 1;
return `${closePrevious}<section class="docs-section" id="${id}"><h2>${heading}</h2>`;
});
return `${decorateMarkdown(wrapped)}</section>`;
}

function decorateMarkdown(content) {
return content
.replaceAll('<pre><code', '<pre class="docs-code"><code')
.replaceAll('<table>', '<div class="config-table-wrap"><table class="config-table">')
.replaceAll('</table>', '</table></div>')
.replaceAll('<blockquote>', '<blockquote class="docs-note">');
}

function renderTableOfContents(headings) {
return headings
.filter(({id}) => id !== 'start')
.map(({id, text}) => `<a href="#${id}">${escapeHtml(text)}</a>`)
.join('\n');
}

function copyPlayerAssets() {
mkdirSync(vendorDirectory, {recursive: true});
copyFileSync(resolve(playerDirectory, 'asciinema-player.min.js'), resolve(vendorDirectory, 'asciinema-player.min.js'));
copyFileSync(resolve(playerDirectory, 'asciinema-player.css'), resolve(vendorDirectory, 'asciinema-player.css'));
copyFileSync(resolve(siteDirectory, 'node_modules/asciinema-player/LICENSE'), resolve(vendorDirectory, 'asciinema-player.LICENSE'));
}

function escapeHtml(value) {
return value
.replaceAll('&', '&amp;')
.replaceAll('<', '&lt;')
.replaceAll('>', '&gt;')
.replaceAll('"', '&quot;');
}
Loading
Loading