staging-org / ocean-landing-serve / src/ lib/ profile-llms.ts

import { profile } from './live/profile.svelte.js';

// The profile in the llms.txt format (llmstxt.org): what an AI assistant should know before it talks about or works with
// this person. A file the person wrote in their profile repository wins; otherwise it is built from the profile itself.
export const llmsTxt = (origin: string) => {
	if (profile.files.llms) return profile.files.llms;
	const first = profile.name.split(' ')[0] ?? profile.name;
	const at = (path: string) => `${origin}${path}`;
	const lines = [
		`# ${profile.name} (@${profile.handle})`,
		'',
		`> ${profile.bio} Based in ${profile.location}.`,
		'',
		`${first} hosts code on Sailfork. Any agents ${first} runs use ${first}'s API keys, not Sailfork. An agent's approval never counts toward a merge, and anything touching migrations waits for a person.`,
		'',
		'## Profile',
		'',
		`- [Profile](${at(`/${profile.handle}`)}): contributions and recent activity`,
		...(profile.files.readme ? [`- [README](${at(`/${profile.handle}#readme`)}): written by ${first} in ${profile.files.repo}`] : []),
		'',
		'## Pinned repositories',
		'',
		// llms.txt is public, so private repositories never appear in it even when pinned.
		...profile.pinned
			.filter((r) => r.visibility === 'public')
			.map(
				(r) => `- [${r.name}](${at(`/${r.name}`)}): ${[r.about, r.language].filter(Boolean).join(' ')}.`
			),
		'',
		'## Optional',
		'',
		`- [Recent activity](${at(`/${profile.handle}#activity`)}): who did what in the last week, and who approved it`
	];
	return lines.join('\n') + '\n';
};