Skip to content

Lomet/postFilter

Repository files navigation

X.com Socratic Post Filter

A Chrome extension that applies the Socratic three-part test to social media posts: "Is it True? Is it Good? Is it Helpful?"

Posts that pass all three tests are shown normally. Posts that fail any test are hidden behind expandable spoilers with explanations.

🌟 Features

  • Socratic Philosophy: Applies Aristotle's three fundamental questions to filter content
  • AI-Powered Analysis: Uses configurable AI models (OpenAI, DeepSeek, etc.) for intelligent content evaluation
  • Text-Based Filtering: Currently analyzes text content only (images/videos planned for future versions)
  • Smart Caching: Analyzes each post only once, storing results locally for efficiency
  • Batch Processing: Processes multiple posts simultaneously for better performance
  • Non-Destructive: Good content stays visible; problematic content is merely hidden behind spoilers
  • Cost Optimized: Intelligent caching reduces API costs by 80-90%

🎯 Philosophy

This extension is built on the principle that good information should flow freely, while potentially harmful, false, or unhelpful content should require deliberate user action to view.

We do not aim to harm or censor anyone. Our goal is to promote thoughtful consumption of information by applying classical philosophical principles to modern social media.

πŸš€ Installation for Development

Prerequisites

  • Chrome browser
  • Node.js (v16 or higher)
  • npm

Steps

  1. Clone the repository

    git clone https://github.com/Lomet/postFilter.git
    cd postFilter
  2. Install dependencies

    npm install
  3. Build the extension

    npm run build
  4. Load in Chrome

    • Open Chrome and navigate to chrome://extensions/
    • Enable "Developer mode" (toggle in top right)
    • Click "Load unpacked"
    • Select the postFilter folder
    • The extension should now appear in your extensions list
  5. Configure AI Settings

    • Click the extension icon in Chrome toolbar
    • Enter your AI configuration:
      • AI URL: Your AI endpoint (e.g., https://api.openai.com/v1 or https://openrouter.ai/api/v1)
      • AI Key: Your API key
      • AI Model: Model name (e.g., gpt-4, deepseek/deepseek-chat-v3)
    • Set batch size (recommended: 3-5 posts per batch)
    • Enable the extension
  6. Visit X.com

    • The extension will automatically start analyzing posts
    • Check browser console (F12) for detailed logging
    • Posts that pass all tests appear normally
    • Posts that fail are hidden behind spoilers

βš™οΈ Configuration

AI Providers

The extension supports any OpenAI-compatible API:

  • OpenAI: https://api.openai.com/v1
  • OpenRouter: https://openrouter.ai/api/v1
  • DeepSeek: Via OpenRouter
  • Local LLMs: Any compatible endpoint

Batch Settings

  • Batch Size: Number of posts analyzed together (1-25)
  • Batch Delay: Delay between batches in milliseconds

Cache Management

  • Posts are cached locally in browser storage
  • Cache automatically expires after 7 days
  • Cache size limited to 500 entries
  • Clear cache by deleting postFilter_cache in DevTools

πŸ› οΈ Development

Project Structure

postFilter/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.ts              # Entry point
β”‚   β”œβ”€β”€ domUtils.ts          # DOM manipulation utilities
β”‚   β”œβ”€β”€ observer.ts          # MutationObserver for dynamic content
β”‚   β”œβ”€β”€ postProcessing.ts    # Post processing pipeline
β”‚   β”œβ”€β”€ spoiler.ts           # Spoiler element creation
β”‚   └── postHandlers/
β”‚       └── postAnlizer.ts   # AI analysis and batch processing
β”œβ”€β”€ manifest.json            # Chrome extension manifest
β”œβ”€β”€ settings.html            # Extension popup interface
β”œβ”€β”€ settings.js             # Popup logic
β”œβ”€β”€ content.js              # Built output file
β”œβ”€β”€ rollup.config.mjs       # Build configuration
β”œβ”€β”€ tsconfig.json           # TypeScript configuration
└── package.json            # Dependencies and scripts

Build Commands

  • npm run build - Build the extension
  • npm run dev - Build in development mode with watching

Key Technologies

  • TypeScript - Type-safe development
  • Rollup - Module bundling
  • OpenAI SDK - AI integration
  • Chrome Extensions API - Browser integration

🀝 Contributing

We welcome contributions! Please follow these guidelines:

How to Contribute

  1. Fork the repository

    git fork https://github.com/Lomet/postFilter.git
  2. Create a feature branch

    git checkout -b feature/your-feature-name
  3. Make your changes

    • Follow existing code style
    • Add comments for complex logic
    • Test thoroughly with different AI providers
  4. Test your changes

    • Build the extension: npm run build
    • Load in Chrome and test on X.com
    • Check console for errors
    • Verify caching works correctly
  5. Commit with clear messages

    git commit -m "feat: add support for custom AI prompts"
  6. Push and create PR

    git push origin feature/your-feature-name
    • Open a Pull Request on GitHub
    • Describe what your changes do
    • Include screenshots if UI changes
    • Reference any related issues

Contribution Guidelines

  • Code Quality: Follow TypeScript best practices
  • Testing: Test with multiple AI providers and batch sizes
  • Documentation: Update README for new features
  • Performance: Consider impact on API costs and browser performance
  • Philosophy: Maintain the core Socratic principles
  • Ethics: Ensure changes promote thoughtful information consumption

Areas for Contribution

  • UI Improvements: Better settings interface, visual indicators
  • AI Providers: Support for new AI services
  • Performance: Optimization for large timelines
  • Features: Custom filtering rules, user preferences
  • Accessibility: Screen reader support, keyboard navigation
  • Internationalization: Multi-language support

πŸ“œ License

MIT License

Copyright (c) 2025 PostFilter Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

πŸ” Troubleshooting

Common Issues

  1. "AI not configured" error

    • Ensure you've entered valid AI URL, key, and model in settings
    • Check that your API key has sufficient credits
  2. No posts being filtered

    • Open browser console (F12) and check for errors
    • Verify extension is enabled in settings
    • Check that you're on x.com (not twitter.com)
  3. All posts showing "Content too short"

    • This indicates the extension can't extract post content
    • Check console for DOM selector issues
    • X.com may have changed their HTML structure
  4. High API costs

    • Reduce batch size in settings
    • Check cache is working (look for "Cache HIT" in console)
    • Consider using cheaper AI models

Debug Mode

Enable detailed logging by opening browser console (F12). You'll see:

  • Post extraction and analysis
  • AI requests and responses
  • Cache hits/misses
  • Batch processing details

⚠️ Known Issues & Limitations

Current Limitations

  1. Text-Only Analysis

    • Issue: The extension currently only analyzes text content from posts
    • Impact: Posts with images, videos, GIFs, or other media are evaluated based solely on their text captions/descriptions
    • Example: A post with a misleading image but accurate text caption might pass the filter
    • Workaround: Users should manually review media-heavy posts
    • Future: Planned support for image analysis using vision-capable AI models
  2. Dynamic Content Loading

    • Issue: X.com loads content dynamically as users scroll
    • Impact: Some posts may not be analyzed immediately upon appearing
    • Status: Partially mitigated by MutationObserver, but edge cases remain
  3. Rate Limiting

    • Issue: Heavy usage may hit AI provider rate limits
    • Impact: Temporary delays in post analysis
    • Workaround: Increase batch delay in settings or use providers with higher limits
  4. Language Support

    • Issue: Analysis quality varies by language
    • Impact: Non-English posts may receive less accurate evaluations
    • Status: Depends on AI model's language capabilities
  5. Context Understanding

    • Issue: Posts referencing external context may be misunderstood
    • Impact: Sarcasm, references, or ongoing conversations might be misanalyzed
    • Note: This is a fundamental limitation of text-based AI analysis

Planned Improvements

  • πŸ–ΌοΈ Vision Analysis: Integration with GPT-4V or similar models for image/video content analysis
  • 🌐 Multi-language: Better support for non-English content
  • ⚑ Performance: Optimized DOM detection for faster processing
  • 🎯 Context Awareness: Improved understanding of conversational context
  • πŸ“Š Analytics: Usage statistics and filtering effectiveness metrics

Reporting Issues

When reporting bugs, please include:

  • Steps to reproduce
  • Browser console output
  • Chrome version
  • Extension version
  • AI provider being used
  • Type of content (text-only, with images, videos, etc.)

πŸ’‘ Feature Requests

Before suggesting features, consider:

  • Does it align with Socratic principles?
  • Does it promote thoughtful information consumption?
  • Is it technically feasible?
  • Would it benefit the broader community?

🎭 Philosophy Statement

This extension embodies the belief that information should be evaluated thoughtfully rather than consumed passively. By applying Socratic questioning to social media content, we aim to:

  • Promote Truth: Surface accurate, factual information
  • Encourage Goodness: Highlight constructive, positive content
  • Ensure Utility: Prioritize helpful, valuable information

We believe in empowering users with tools for critical thinking, not in making decisions for them. The extension merely provides a philosophical lens through which to view informationβ€”the choice of what to engage with remains entirely with the user.


"The unexamined life is not worth living." - Socrates

Made with 🧠 for thoughtful information consumption.

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published