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
47 changes: 47 additions & 0 deletions .github/workflows/project-inheritance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: project-inheritance

on:
workflow_dispatch:
schedule:
- cron: '23 9 * * 1'
pull_request:
paths:
- 'scripts/collect-projects.py'
- 'src/data/project-sources.json'
- '.github/workflows/project-inheritance.yml'

permissions:
contents: read

jobs:
observe:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Collect public repository observations
env:
GH_TOKEN: ${{ github.token }}
run: python3 scripts/collect-projects.py --output observations/project-observations.json
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Validate observations at the application boundary
env:
STELE_OBSERVATIONS: observations/project-observations.json
run: pnpm exec vitest run src/lib/__tests__/project-observations.test.ts
- name: Record collection scope
run: |
{
echo 'Public repository metadata and revision-pinned source links for philosopher-scribe review.'
echo 'Download the artifact and load project-observations.json in the Collaborator panel.'
echo 'Repository descriptions are author statements. Applying a draft requires session review.'
sha256sum observations/project-observations.json
} >> "$GITHUB_STEP_SUMMARY"
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: stele-project-observations
path: observations/project-observations.json
if-no-files-found: error
62 changes: 62 additions & 0 deletions docs/research/project-inheritance/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Osmotic project context

The philosopher-scribe introduced in `42978c5` and narrative export introduced
in `93fd122` provide the session review and export path. This extension supplies
repository observations to that path and distributes the authority lesson from
Stratum ADR-003 and the tor-reference incident in compiled integration context.

## Refresh and use

Run `python3 scripts/collect-projects.py` from a checkout with the GitHub CLI
signed in. Collection reads the public repositories listed in
`src/data/project-sources.json`. The output replaces
`src/data/project-observations.json` atomically after all repositories respond.
Review that diff through the normal pull-request process to update the bundled
catalog. Existing IDs continue to select the same projects.

In Stele, select projects in the rail and open Collaborator. Choose an observed
project, inspect its commit and source links, edit its identity draft, then
apply it to the session. The draft is gated before application and produces a
TSUGI audit event. Narrative export retains the reviewed text and its observed
source citation. All three compilation targets include repository provenance
and reviewed session context. EPOCHÉ continues to replace normal output.

The optional model-assisted philosopher-scribe receives the bundled structural
context and observations. Calling it requires the existing session API key.
The offline review path works directly from collected repository descriptions.

## CI

`project-inheritance.yml` runs weekly, manually and when its collector changes.
It collects public metadata at default-branch revisions, validates the report
through the same application parser and uploads `stele-project-observations`.
Download the artifact, extract `project-observations.json`, and load it through
Collaborator's file input. A scheduled collection becomes available after this
workflow lands on the default branch.

CI uses read-only repository permissions. It produces a review artifact. Applying
observations to a session and updating the bundled catalog use the review paths
above. Repository descriptions are author statements. Source links and Git blob
identities locate source material but do not prove the descriptions' claims.
The collector records source identities without executing repository code or
reading private repositories. It makes no model calls.

## Boundaries

The report schema accepts repository identity, revision, observation time,
description, language and fixed source-file identities. It refuses governance
fields, unknown projects, duplicate projects and source-link substitution.
The existing TOBIRA gate screens description content and edited identity drafts.
Its lexical coverage retains the limitations in the Stele threat model.

This work leaves existing hard stops and posture as authored configuration.
The five newly registered integration projects have explicit initial posture
choices and empty project-specific hard stops. Their catalog entries require
ongoing review as their repositories evolve. Legacy projects without a configured
source remain authored entries.

The tor-reference case study and TESTAMENT are first-party incident records.
Their shared-credential and signing observations inform the compiled authority
context. The raw MCP transcripts have not been independently audited here.
Stratum authority-registry design and deployed ingress behavior retain their
recorded implementation boundaries. This refresh does not attest a human act.
69 changes: 69 additions & 0 deletions scripts/collect-projects.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/usr/bin/env python3
"""Collect public repository observations for Stele's philosopher-scribe."""
import argparse
import hashlib
import json
import os
import re
from pathlib import Path
import subprocess
import tempfile
from datetime import datetime, timezone

ROOT = Path(__file__).resolve().parents[1]


def github(path):
result = subprocess.run(['gh', 'api', path], capture_output=True, text=True)
if result.returncode:
raise RuntimeError('GitHub observation unavailable for ' + path.split('/contents/')[0])
return json.loads(result.stdout)


def collect():
projects = []
seen = set()
for target in json.loads((ROOT / 'src/data/project-sources.json').read_text()):
repository = target['repository']
if not re.fullmatch(r'mazze93/[A-Za-z0-9_.-]+', repository) or target['projectId'] in seen:
raise ValueError('Invalid or repeated project source')
seen.add(target['projectId'])
metadata = github('repos/' + repository)
if metadata['visibility'] != 'public':
raise ValueError('Only public repositories may enter the distributed catalog')
commit = github('repos/' + repository + '/commits/' + metadata['default_branch'])
sha = commit['sha']
tree = github('repos/' + repository + '/git/trees/' + commit['commit']['tree']['sha'])
files = {entry['path']: entry for entry in tree['tree'] if entry['type'] == 'blob'}
sources = []
for name in ['README.md', 'CLAUDE.md', 'AGENTS.md', 'package.json', 'pyproject.toml', 'Cargo.toml', 'Package.swift', 'AUTHORITY.md']:
if name in files:
sources.append({'path': name, 'gitBlob': files[name]['sha'],
'url': 'https://github.com/' + repository + '/blob/' + sha + '/' + name})
observation = {
'projectId': target['projectId'], 'repository': repository,
'commit': sha, 'observedAt': datetime.now(timezone.utc).isoformat(),
'description': metadata['description'] or '',
'language': metadata['language'] or 'Unspecified',
'sources': sources,
}
projects.append(observation)
return {'schemaVersion': 1, 'kind': 'stele-project-observations', 'projects': projects}


def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--output', type=Path, default=ROOT / 'src/data/project-observations.json')
args = parser.parse_args()
report = collect() # Fetch everything before replacing the last complete snapshot.
args.output.parent.mkdir(parents=True, exist_ok=True)
content = json.dumps(report, ensure_ascii=False, indent=2) + '\n'
with tempfile.NamedTemporaryFile(mode='w', dir=args.output.parent, delete=False) as stream:
stream.write(content)
temporary = stream.name
os.replace(temporary, args.output)
print(f"Observed {len(report['projects'])} public repositories; sha256 {hashlib.sha256(content.encode()).hexdigest()}")


if __name__ == '__main__':
main()
23 changes: 22 additions & 1 deletion src/components/panels/CollaboratorPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ProjectObservationPanel } from './ProjectObservationPanel'
import { useState } from 'react'
import type { DirectiveState } from '@/lib/types'
import type { IntegrityState } from '@/lib/integrity'
Expand Down Expand Up @@ -30,7 +31,18 @@ type Props = {
onAuditEntry: (action: AuditAction, extras?: AuditExtras) => void
}

export function CollaboratorPanel({
export function CollaboratorPanel(props: Props) {
return <div style={{ display: 'flex', flexDirection: 'column', gap: '20px' }}>
<ProjectObservationPanel state={props.state} onGateResult={props.onGateResult} onApply={(projectId, narrative) => {
props.onApplyNarrative(projectId, narrative)
props.onAuditEntry('tsugi-applied', { fieldsExtracted: ['identity'] })
}} />
<h3 style={sHead}>Optional model-assisted narrative</h3>
<ModelCollaboratorPanel {...props} />
</div>
}

function ModelCollaboratorPanel({
state, integrityState, apiKey, onSetApiKey, onGateResult, onApplyNarrative, onAuditEntry,
}: Props) {
const activeProjects = PROJECTS.filter(p => state.activeProjectIds.includes(p.id))
Expand Down Expand Up @@ -112,6 +124,7 @@ export function CollaboratorPanel({
compliance: selectedProject.compliance,
tesserae: (selectedProject.tesserae ?? []).map(t => ({ module: t.module, missingHalf: t.missingHalf, group: t.group })),
openQuestions: selectedProject.openQuestions,
observation: selectedProject.observation,
})

const result = gate(serialized)
Expand All @@ -133,6 +146,7 @@ export function CollaboratorPanel({
hardStops: selectedProject.hardStops,
tesserae: (selectedProject.tesserae ?? []).map(t => ({ module: t.module, missingHalf: t.missingHalf, group: t.group })),
openQuestions: selectedProject.openQuestions,
observation: selectedProject.observation,
}

try {
Expand All @@ -159,6 +173,13 @@ export function CollaboratorPanel({
buildSequencing: fields.buildSequencing,
unstatedConstraints: fields.unstatedConstraints,
}
const result = gate(JSON.stringify(narrative))
setGateResult(result)
onGateResult(result)
if (result.blocked) {
setStatus('blocked')
return
}
onApplyNarrative(selectedId, narrative)
onAuditEntry('tsugi-applied', { fieldsExtracted: ['identity', 'philosophy', 'buildSequencing', 'unstatedConstraints'] })
setStatus('applied')
Expand Down
89 changes: 89 additions & 0 deletions src/components/panels/ProjectObservationPanel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import { useState } from 'react'
import type { DirectiveState } from '@/lib/types'
import type { NarrativeFields } from '@/lib/extractor'
import { gate } from '@/lib/security'
import type { GateResult } from '@/lib/security'
import { INTEGRITY_STATES } from '@/lib/integrity'
import { parseProjectObservations } from '@/lib/project-observations'
import type { ProjectObservation } from '@/lib/project-observations'
import report from '@/data/project-observations.json'
import { buildProjectNarrativeExport, downloadNarrativeExport } from '@/lib/narrativeExport'
import { PROJECTS } from '@/data/projects'

const bundled = parseProjectObservations(JSON.stringify(report))

type Props = {
state: DirectiveState
onGateResult: (result: GateResult) => void
onApply: (projectId: string, narrative: NarrativeFields) => void
}

export function ProjectObservationPanel({ state, onApply, onGateResult }: Props) {
const [observations, setObservations] = useState(bundled)
const [selected, setSelected] = useState<ProjectObservation | null>(null)
const [draft, setDraft] = useState('')
const [message, setMessage] = useState('')
const active = observations.filter(project => state.activeProjectIds.includes(project.projectId))
const allowed = INTEGRITY_STATES[state.integrityState].allowsPatchApplication

async function load(file: File | undefined) {
if (!file) return
try {
if (file.size > 100_000) throw new Error('Observation file exceeds 100,000 bytes')
const next = parseProjectObservations(await file.text())
setObservations(next)
setSelected(null)
setDraft('')
setMessage('Repository observations loaded for review.')
} catch {
setMessage('KIRI — observation file rejected. Use an unmodified Stele CI observation artifact.')
}
}

function review(observation: ProjectObservation) {
setSelected(observation)
setDraft(observation.description)
setMessage('')
}

function apply() {
if (!selected || !allowed || !state.activeProjectIds.includes(selected.projectId)) return
const result = gate(draft)
onGateResult(result)
if (result.blocked) {
setMessage('KIRI — TOBIRA blocked the identity draft.')
return
}
const project = PROJECTS.find(item => item.id === selected.projectId)
if (!project) return
const current = state.projectNarratives[selected.projectId]
onApply(project.id, {
identity: `${draft}\n\nRepository description observed ${selected.observedAt} at https://github.com/${selected.repository}/tree/${selected.commit}. Session-applied identity draft.`,
philosophy: current?.philosophy ?? project.philosophy ?? '',
buildSequencing: current?.buildSequencing ?? project.buildSequencing ?? '',
unstatedConstraints: current?.unstatedConstraints ?? project.unstatedConstraints ?? '',
})
setMessage('TSUGI — reviewed identity applied to this session. Export the narrative to retain it.')
}

return <section className="workspace-card" aria-label="Repository observations">
<h3>Osmotic project context</h3>
<p>Review revision-pinned repository observations before applying an identity draft. Repository descriptions are author statements. The recorded commit identifies the observed source.</p>
<label className="workspace-link">Load CI observations <input type="file" accept=".json,application/json" onChange={event => { void load(event.target.files?.[0]) }} /></label>
{active.length === 0 && <p>Select a project in Config to review its repository context.</p>}
<div className="workspace-actions">{active.map(item => <button key={item.projectId} className="workspace-link" onClick={() => review(item)}>{PROJECTS.find(project => project.id === item.projectId)?.label}</button>)}</div>
{selected && <div>
<p>{selected.repository} · {selected.language}</p>
<p className="workspace-note">Observed {selected.observedAt} · {selected.commit.slice(0, 12)}</p>
<ul>{selected.sources.map(source => <li key={source.path}><a href={source.url} target="_blank" rel="noreferrer">{source.path} at observed revision</a></li>)}</ul>
<label>Identity draft<textarea aria-label="Observed identity draft" value={draft} onChange={event => setDraft(event.target.value)} rows={4} style={{ width: '100%', color: 'var(--vellum)', background: 'var(--surface)', border: '1px solid var(--border-color)' }} /></label>
<button className="workspace-link" disabled={!allowed || !draft.trim()} onClick={apply}>Apply reviewed identity to session</button>
{!allowed && <p>{state.integrityState} — patch application suspended.</p>}
</div>}
{selected && state.projectNarratives[selected.projectId] && <button className="workspace-link" onClick={() => {
const project = PROJECTS.find(item => item.id === selected.projectId)
if (project) downloadNarrativeExport(buildProjectNarrativeExport(project, state, {}))
}}>Export reviewed project narrative</button>}
{message && <p role="status">{message}</p>}
</section>
}
Loading
Loading