diff --git a/.github/workflows/mirror-pr-to-forgejo.yml b/.github/workflows/mirror-pr-to-forgejo.yml new file mode 100644 index 0000000..08766a1 --- /dev/null +++ b/.github/workflows/mirror-pr-to-forgejo.yml @@ -0,0 +1,106 @@ +name: Mirror PR to Forgejo + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + mirror: + runs-on: ubuntu-latest + steps: + - name: Comment on PR + uses: actions/github-script@v7 + with: + script: | + const { data: comments } = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }); + + // Don't double-comment + const botComment = comments.find(c => c.body.includes('mirror-to-forgejo')); + if (botComment) return; + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: ` + 👋 Thanks for your contribution! This repo uses [Forgejo](https://git.livingip.xyz/teleo/teleo-codex) as its primary git host. Your PR is being mirrored there for automated review. + + **What happens next:** + - Your branch is being pushed to our Forgejo instance + - A corresponding PR will be created for our 3-agent review pipeline + - Leo (cross-domain), a domain peer, and a self-review agent will evaluate your changes + - If approved, it merges on Forgejo and syncs back here automatically + + You don't need to do anything — we'll update this PR with the review results. + + *Teleo eval pipeline — [git.livingip.xyz](https://git.livingip.xyz/teleo/teleo-codex)*` + }); + + - name: Checkout PR branch + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + fetch-depth: 0 + + - name: Mirror branch to Forgejo + env: + FORGEJO_TOKEN: ${{ secrets.FORGEJO_MIRROR_TOKEN }} + run: | + BRANCH="${{ github.event.pull_request.head.ref }}" + + # Add Forgejo remote + git remote add forgejo "https://github-mirror:${FORGEJO_TOKEN}@git.livingip.xyz/teleo/teleo-codex.git" + + # Push the branch + git push forgejo "HEAD:refs/heads/${BRANCH}" --force + + echo "Branch ${BRANCH} pushed to Forgejo" + + - name: Create PR on Forgejo + env: + FORGEJO_TOKEN: ${{ secrets.FORGEJO_MIRROR_TOKEN }} + run: | + BRANCH="${{ github.event.pull_request.head.ref }}" + TITLE="${{ github.event.pull_request.title }}" + BODY="${{ github.event.pull_request.body }}" + GH_PR="${{ github.event.pull_request.number }}" + GH_AUTHOR="${{ github.event.pull_request.user.login }}" + + # Check if PR already exists for this branch + EXISTING=$(curl -s -H "Authorization: token ${FORGEJO_TOKEN}" \ + "https://git.livingip.xyz/api/v1/repos/teleo/teleo-codex/pulls?state=open" \ + | jq -r ".[] | select(.head.ref == \"${BRANCH}\") | .number") + + if [ -n "$EXISTING" ]; then + echo "PR already exists on Forgejo: #${EXISTING}" + exit 0 + fi + + # Create PR on Forgejo + PR_BODY="Mirrored from GitHub PR #${GH_PR} by @${GH_AUTHOR} + + ${BODY} + + --- + *Mirrored automatically from [GitHub PR #${GH_PR}](https://github.com/living-ip/teleo-codex/pull/${GH_PR})*" + + RESPONSE=$(curl -s -X POST \ + -H "Authorization: token ${FORGEJO_TOKEN}" \ + -H "Content-Type: application/json" \ + -d "$(jq -n --arg title "$TITLE" --arg body "$PR_BODY" --arg head "$BRANCH" \ + '{title: $title, body: $body, head: $head, base: "main"}')" \ + "https://git.livingip.xyz/api/v1/repos/teleo/teleo-codex/pulls") + + FORGEJO_PR=$(echo "$RESPONSE" | jq -r '.number // empty') + + if [ -n "$FORGEJO_PR" ]; then + echo "Created Forgejo PR #${FORGEJO_PR}" + else + echo "Failed to create Forgejo PR:" + echo "$RESPONSE" + exit 1 + fi diff --git a/skills/submit.md b/skills/submit.md new file mode 100644 index 0000000..b3aa332 --- /dev/null +++ b/skills/submit.md @@ -0,0 +1,195 @@ +# Skill: Submit + +Get your claims and source archives into the knowledge base via PR. + +## When to Use + +After running `skills/extract.md` — you have claim files and source archives ready to propose. + +## Prerequisites + +Your Forgejo token is at `~/.pentagon/secrets/forgejo-{your-name}-token` (e.g., `forgejo-rio-token`). + +Set up the git remote once per worktree: + +```bash +AGENT_TOKEN=$(cat ~/.pentagon/secrets/forgejo-{your-name}-token) +git remote add forgejo https://{your-name}:${AGENT_TOKEN}@git.livingip.xyz/teleo/teleo-codex.git +``` + +If the `forgejo` remote already exists, skip this. You can check with `git remote -v`. + +## Process + +### Step 1: Branch from latest main + +```bash +git fetch forgejo +git checkout -b {your-name}/{brief-description} forgejo/main +``` + +Branch names: `rio/displacement-claims`, `clay/shapiro-extraction`, `theseus/fep-batch-1`, etc. + +### Step 2: Create source archives + +For each source, create a file in `inbox/archive/` following `schemas/source.md`: + +```yaml +--- +type: source +title: "Article title" +author: "Name (@handle)" +twitter_id: "stable numeric ID if from X" +url: https://example.com/article +date: 2026-03-09 +domain: internet-finance +format: essay +status: unprocessed +tags: [topic1, topic2] +--- +``` + +If the source is from X, always include `twitter_id` — handles change, IDs don't. Get the ID from the tweet author object or via `/x-research`. + +### Step 3: Write claim files + +Create `.md` files in `domains/{your-domain}/` with proper YAML frontmatter: + +```yaml +--- +type: claim +domain: internet-finance +description: "one sentence adding context beyond the title" +confidence: proven | likely | experimental | speculative +source: "who proposed this and primary evidence" +created: 2026-03-09 +--- +``` + +- One claim per file +- Filename = slugified title (lowercase, hyphens, no special chars) +- Title IS the claim — prose proposition, not a label +- Evidence cited inline in the body +- Wiki links `[[to related claims]]` where they exist + +See CLAUDE.md "Claim Schema" for full spec. + +### Step 4: Update source archive status + +After extraction, update the source file frontmatter: + +```yaml +status: processed +processed_by: {your-name} +processed_date: 2026-03-09 +claims_extracted: + - "claim title 1" + - "claim title 2" +enrichments: + - "existing claim that was updated" +``` + +### Step 5: Commit with trailers + +```bash +git add domains/{your-domain}/*.md inbox/archive/*.md +git commit -m "{your-name}: add N claims about {topic} + +- What: brief description of claims added +- Why: source material reference, why these matter +- Connections: what existing claims these relate to + +Pentagon-Agent: {YourName} <{your-pentagon-UUID}> +Model: {your-model-id}" +``` + +Both trailers are required on every commit. Find your Pentagon UUID in your agent config. Model ID is the exact model you're running on (e.g., `claude-opus-4-6`, `claude-sonnet-4-5-20250514`). + +### Step 6: Push to Forgejo + +```bash +git push forgejo {your-name}/{brief-description} +``` + +**Push to the `forgejo` remote only. Never push to `origin` (GitHub).** GitHub is a read-only mirror. Pushing to GitHub will cause your branch to be deleted and your PR auto-closed by the mirror sync. + +### Step 7: Create PR via Forgejo API + +```bash +AGENT_TOKEN=$(cat ~/.pentagon/secrets/forgejo-{your-name}-token) + +curl -s -X POST \ + -H "Authorization: token $AGENT_TOKEN" \ + -H "Content-Type: application/json" \ + -d "$(jq -n \ + --arg title '{your-name}: brief PR title' \ + --arg body 'Summary of claims proposed. +Source: [reference] +Why: [what these add to the knowledge base] +Connections: [existing claims these relate to or challenge]' \ + --arg head '{your-name}/{brief-description}' \ + '{title: $title, body: $body, head: $head, base: "main"}')" \ + "https://git.livingip.xyz/api/v1/repos/teleo/teleo-codex/pulls" +``` + +The PR body should include: summary of claims, source reference, why they add value, and any claims that challenge or extend existing ones. + +### Step 8: Wait for review + +The eval pipeline runs automatically every 2 minutes: + +1. **Leo** reviews (cross-domain quality, on opus) +2. **Domain peer** reviews (domain expertise, on sonnet) +3. **Self-review** of your own PR (adversarial, on alternate model) + +Outcomes: +- **All approve** — auto-merge via squash +- **Changes requested** — read the review comments, fix on the same branch, push again. The pipeline re-evaluates automatically. + +## Checking PR Status + +```bash +AGENT_TOKEN=$(cat ~/.pentagon/secrets/forgejo-{your-name}-token) + +# List your open PRs +curl -s -H "Authorization: token $AGENT_TOKEN" \ + "https://git.livingip.xyz/api/v1/repos/teleo/teleo-codex/pulls?state=open" \ + | jq '.[] | {number, title, state}' + +# Read review comments on a specific PR +curl -s -H "Authorization: token $AGENT_TOKEN" \ + "https://git.livingip.xyz/api/v1/repos/teleo/teleo-codex/pulls/{PR_NUMBER}/reviews" \ + | jq '.[] | {user: .user.login, state: .state, body: .body}' +``` + +## Handling Review Feedback + +When a reviewer requests changes: + +1. Read the review comments carefully +2. **Mechanical fixes** (broken wiki links, missing frontmatter, schema issues) — fix immediately +3. **Substantive feedback** (confidence calibration, reframing, domain classification) — exercise judgment, make changes you agree with +4. If you disagree with feedback, comment on the PR explaining your reasoning +5. Commit fixes to the same branch and push — the pipeline re-evaluates + +```bash +git add -u +git commit -m "{your-name}: address review feedback on PR #{number} + +- Fixed: [what you changed] + +Pentagon-Agent: {YourName} <{your-UUID}> +Model: {model-id}" +git push forgejo {your-name}/{brief-description} +``` + +**Do not start new extraction work while you have PRs with requested changes.** Fix first, then move on. + +## Rules + +1. **Never push to GitHub.** Only push to the `forgejo` remote. +2. **Never commit to main.** Always branch + PR. +3. **Never merge your own PR.** The eval pipeline handles merge. +4. **Always include both git trailers** (Pentagon-Agent and Model). +5. **Always archive the source** before or alongside claim extraction. +6. **Always update source status** after extraction completes.