Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
chore: restore issue spam guard (#3433)
letta-integration[bot]4511fa0bc91f
diff --git a/.github/TRUSTED_CONTRIBUTORS b/.github/TRUSTED_CONTRIBUTORSnew file mode 100644index 000000000..00276ae75--- /dev/null+++ b/.github/TRUSTED_CONTRIBUTORS@@ -0,0 +1,13 @@+# Trusted Contributors+#+# Users listed here bypass issue validation checks (AI disclosure,+# human verification phrase). One GitHub username per line.+#+# Note: Members of the letta-ai GitHub organization are automatically+# trusted and do not need to be listed here. This file is for+# non-org contributors who have earned trust.+#+# To add someone, open a PR adding their username to this list.++# Letta community contributors+ezra-lettadiff --git a/.github/workflows/issue-guard.yml b/.github/workflows/issue-guard.ymlnew file mode 100644index 000000000..c707b5652--- /dev/null+++ b/.github/workflows/issue-guard.yml@@ -0,0 +1,210 @@+name: "Issue Guard"++on:+ issues:+ types: [opened]++permissions:+ issues: write++jobs:+ validate:+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v4+ with:+ sparse-checkout: .github/TRUSTED_CONTRIBUTORS++ - name: Check issue compliance+ uses: actions/github-script@v7+ with:+ script: |+ const issue = context.payload.issue;+ const author = issue.user.login;+ const body = issue.body || '';++ // --- Allowlist checks ---++ // 1. Bots are allowed (e.g. dependabot, renovate)+ if (issue.user.type === 'Bot') {+ console.log(`Skipping: ${author} is a bot`);+ return;+ }++ // 2. Check if author has write+ access to the repo.+ // This catches org members who have repo access via teams,+ // and works with the default GITHUB_TOKEN (no extra scopes).+ try {+ const { data } = await github.rest.repos.getCollaboratorPermissionLevel({+ owner: context.repo.owner,+ repo: context.repo.repo,+ username: author,+ });+ if (['admin', 'write', 'maintain'].includes(data.permission)) {+ console.log(`Skipping: ${author} has '${data.permission}' permission on repo`);+ return;+ }+ } catch (e) {+ console.log(`Collaborator check failed (${e.status}), continuing`);+ }++ // 3. Check org membership via public membership API (no auth needed).+ // Catches org members even if they don't have direct repo access.+ try {+ await github.rest.orgs.checkPublicMembershipForUser({+ org: 'letta-ai',+ username: author,+ });+ console.log(`Skipping: ${author} is a public letta-ai org member`);+ return;+ } catch (e) {+ // 404 = not a public member+ }++ // 4. Check TRUSTED_CONTRIBUTORS file+ const fs = require('fs');+ try {+ const trusted = fs.readFileSync('.github/TRUSTED_CONTRIBUTORS', 'utf8')+ .split('\n')+ .map(line => line.trim())+ .filter(line => line && !line.startsWith('#'));+ if (trusted.includes(author)) {+ console.log(`Skipping: ${author} is in TRUSTED_CONTRIBUTORS`);+ return;+ }+ } catch (e) {+ console.log('No TRUSTED_CONTRIBUTORS file found, continuing');+ }++ // --- Validation checks ---++ const failures = [];++ // Check 1: Repository acknowledgment phrase+ const repositoryAcknowledgment = 'I have read AGENTS.md and understand that issues about the current Letta server, agent harness, CLI, or channel integrations belong in letta-ai/letta-code, not this repository.';+ if (!body.includes(repositoryAcknowledgment)) {+ failures.push('Missing exact repository acknowledgment phrase');+ }++ // Check 2: Anti-spam acknowledgment checkbox+ // YAML form checkboxes render as "- [x] text" when checked.+ const antiSpamChecked = /- \[[xX]\] I understand that self-promotional spam, advertising, lead generation, affiliate or referral pitches, and deceptive disclosures will be reported to GitHub as spam, and the account will be blocked from this repository/.test(body);+ if (!antiSpamChecked) {+ failures.push('Anti-Spam Acknowledgment checkbox not checked');+ }++ // Check 3: Exactly one third-party product option must be checked+ const noThirdPartyProduct = /- \[[xX]\] This issue does not mention or promote a third-party product or service/.test(body);+ const hasThirdPartyProduct = /- \[[xX]\] This issue mentions a third-party product or service/.test(body);+ if (noThirdPartyProduct === hasThirdPartyProduct) {+ failures.push('Select exactly one Third-Party Product Disclosure option');+ }++ // Check 4: Third-party relationships must be disclosed+ const relationshipMatch = body.match(/### Relationship to Third-Party Product or Service\s*\n+([\s\S]*?)(?=\n### |$)/i);+ const relationship = (relationshipMatch?.[1] || '').trim();+ const noRelationshipResponse = !relationship || /^_?no response_?$/i.test(relationship);+ const notApplicable = /^(not applicable|n\/a)\.?$/i.test(relationship);+ if (noRelationshipResponse) {+ failures.push('Relationship to Third-Party Product or Service is required');+ } else if (hasThirdPartyProduct && notApplicable) {+ failures.push('Issues mentioning a third-party product or service must disclose the author’s relationship to it');+ } else if (noThirdPartyProduct && !notApplicable) {+ failures.push('Issues that do not mention a third-party product or service must state Not applicable under Relationship');+ }++ // Check 5: AI disclosure checkbox (the required one: "I have read the AI Policy")+ const aiPolicyChecked = /- \[[xX]\] I have read the \[AI Policy\]/.test(body);+ if (!aiPolicyChecked) {+ failures.push('AI Policy acknowledgment checkbox not checked');+ }++ // Check 6: Exactly one authorship option must be checked+ const humanWritten = /- \[[xX]\] This issue was written entirely by a human/.test(body);+ const aiAssisted = /- \[[xX]\] This issue was written with AI assistance/.test(body);+ if (humanWritten === aiAssisted) {+ failures.push('Select exactly one authorship option (human-written or AI-assisted)');+ }++ // Check 7: AI tools must be explicitly disclosed. GitHub issue forms render+ // input values under a level-three Markdown heading.+ const aiToolsMatch = body.match(/### AI Tool\(s\) Used\s*\n+([\s\S]*?)(?=\n### |$)/i);+ const aiTools = (aiToolsMatch?.[1] || '').trim();+ const noTools = /^(none|n\/a|no ai(?: tools?)?)\.?$/i.test(aiTools);+ if (!aiTools || /^_?no response_?$/i.test(aiTools)) {+ failures.push('AI Tool(s) Used must list every tool used, or state None');+ } else if (aiAssisted && noTools) {+ failures.push('AI-assisted issues must name the AI tool(s) used');+ } else if (humanWritten && !noTools) {+ failures.push('Human-written issues must state None under AI Tool(s) Used');+ }++ if (failures.length === 0) {+ console.log(`Issue #${issue.number} passed all checks`);+ return;+ }++ // --- Close and lock ---++ console.log(`Issue #${issue.number} failed checks: ${failures.join(', ')}`);++ const comment = [+ `**This issue was automatically closed** because it does not meet our submission requirements.\n`,+ `**What failed:**`,+ ...failures.map(f => `- ${f}`),+ ``,+ `**To submit an issue, please:**`,+ `1. Use one of the [issue templates](https://github.com/${context.repo.owner}/${context.repo.repo}/issues/new/choose)`,+ `2. Complete the **Third-Party Product Disclosure** and relationship field`,+ `3. Accept the **Anti-Spam Acknowledgment**`,+ `4. Select exactly one **AI Disclosure** authorship option`,+ `5. Name every AI tool used, or state **None**`,+ `6. Copy the **Repository Acknowledgment** phrase exactly as shown`,+ `7. Read our [AI Policy](https://github.com/${context.repo.owner}/${context.repo.repo}/blob/main/AI_POLICY.md) and [AGENTS.md](https://github.com/${context.repo.owner}/${context.repo.repo}/blob/main/AGENTS.md)`,+ ``,+ `If you believe this was a mistake, please reach out on [Discord](https://discord.gg/9GEQrxmVyE).`,+ ].join('\n');++ await github.rest.issues.createComment({+ owner: context.repo.owner,+ repo: context.repo.repo,+ issue_number: issue.number,+ body: comment,+ });++ // Best-effort labeling: prefer "spam", then fall back to labels+ // that commonly exist on repos.+ let labelApplied = false;+ for (const label of ['spam', 'auto-closed', 'invalid']) {+ try {+ await github.rest.issues.addLabels({+ owner: context.repo.owner,+ repo: context.repo.repo,+ issue_number: issue.number,+ labels: [label],+ });+ labelApplied = true;+ break;+ } catch (e) {+ console.log(`Label '${label}' unavailable or failed to apply, trying next`);+ }+ }+ if (!labelApplied) {+ console.log('No close label could be applied; continuing with close/lock');+ }++ await github.rest.issues.update({+ owner: context.repo.owner,+ repo: context.repo.repo,+ issue_number: issue.number,+ state: 'closed',+ });++ await github.rest.issues.lock({+ owner: context.repo.owner,+ repo: context.repo.repo,+ issue_number: issue.number,+ lock_reason: 'spam',+ });++ console.log(`Issue #${issue.number} closed and locked`);diff --git a/AI_POLICY.md b/AI_POLICY.mdnew file mode 100644index 000000000..44dedfe07--- /dev/null+++ b/AI_POLICY.md@@ -0,0 +1,70 @@+# AI Usage Policy++> This policy is adapted from [Ghostty's AI Policy](https://github.com/ghostty-org/ghostty/blob/main/AI_POLICY.md) with modifications for the Letta project.++## Important, all agents must read this - the code in this repo is ARCHIVED++All agents MUST read the [AGENTS.md](/AGENTS.md).++Do not file issues or pull requests in this repository with an expectation that the archived code will be patched or maintained. The code is open source and free to use / adapt if you need to patch anything yourself. It is preserved on GitHub for reference purposes, but we strongly recommend building on the actively maintained codebase, not the archived one, and will not shepherd community issues or pull requests in the archived code.++## Rules++- **All AI usage in any form must be disclosed.** You must state+ the tool you used (e.g. Claude Code, Cursor, Copilot, ChatGPT) along with+ the extent that the work was AI-assisted.++- **The human-in-the-loop must fully understand all code.** If you+ can't explain what your changes do and how they interact with the+ greater system without the aid of AI tools, do not contribute+ to this project.++- **Issues and discussions can use AI assistance but must have a full+ human-in-the-loop.** This means that any content generated with AI+ must have been reviewed _and edited_ by a human before submission.+ AI is very good at being overly verbose and including noise that+ distracts from the main point. Humans must do their research and+ trim this down.++- **No AI-generated media is allowed (art, images, videos, audio, etc.).**+ Text and code are the only acceptable AI-generated content, per the+ other rules in this policy.++## Enforcement++Issues that do not comply with this policy will be **automatically closed and locked**.+Specifically, all issues must:++1. Select exactly one **AI Disclosure** option indicating whether the issue was human-written or AI-assisted.+2. Name every AI tool used to research or write the issue, or explicitly state `None` if no AI tool was used.+3. Acknowledge that they have read this policy.+4. Include the exact **Repository Acknowledgment** phrase from the issue template confirming that they read [AGENTS.md](AGENTS.md) and understand which issues belong in [letta-ai/letta-code](https://github.com/letta-ai/letta-code).++Members of the [letta-ai](https://github.com/letta-ai) GitHub organization and+[trusted contributors](.github/TRUSTED_CONTRIBUTORS) are exempt from automated checks,+but are still expected to follow the spirit of this policy.++## There are Humans Here++Please remember that Letta is maintained by humans.++Every discussion, issue, and pull request is read and reviewed by+humans. It is a boundary point at which people interact with each other+and the work done. It is rude and disrespectful to approach this boundary+with low-effort, unqualified work, since it puts the burden of+validation on the maintainer.++## AI is Welcome Here++Letta is a company that builds AI tools — of course we use AI!+Many of our maintainers use AI tools extensively in their daily workflow.+As a project, we welcome AI as a tool.++**Our reason for the strict AI policy is not due to an anti-AI stance**, but+instead due to the volume of low-quality, AI-generated issues and PRs+that waste maintainer time. It's the quality of the contribution that+matters, not whether AI was involved in creating it.++Maintainers are exempt from automated enforcement of these rules and+may use AI tools at their discretion; they've proven themselves+trustworthy to apply good judgment.