Skip to content

AICMO/AiCMO-Content-As-A-Code

Repository files navigation

Content Library - Automated Publishing System

Content as Code - Time-Based Publishing Architecture

This repository serves as the central hub for automated social media and blog publishing across multiple platforms using a revolutionary "directory timestamps as schedule" approach.

Purpose

Centralized content management and automated publishing system for:

  • LinkedIn, Twitter/X, Facebook, Instagram, TikTok, YouTube
  • Company and personal account management
  • Time-based scheduling with immediate publishing capability
  • Organized content lifecycle management

Architecture Overview

Revolutionary Simplification: Directory names ARE the complete metadata. No external files or JSON manifests needed.

content/
├── approved/                              # Human-reviewed content pool
├── scheduled/                             # Time-based execution queue with platform metadata
│   ├── 2025-08-14T15-45-00Z_x_personal/  # Future time + platform + account = wait until then
│   ├── 2025-08-14T17-30-00Z_linkedin_company/  # Platform-specific directories
│   └── 2020-01-01T00-00-00Z_substack_ai-weekly/  # Past time = publish immediately
├── published/                             # Successfully published (preserves directory names)
│   ├── 2025-08-13T10-00-00Z_linkedin_company/
│   └── 2025-08-13T15-45-00Z_x_personal/
└── failed/                                # Needs manual intervention (preserves directory names)
    └── 2025-08-12T08-00-00Z_x_personal/

calendar/
├── schedules/                   # Human-readable planning files
│   └── week-32-2025.yml
└── processed/                   # Archived schedules

Core Principles

  1. Directory names are metadata - Timestamp directories define when to publish
  2. Content files never renamed - Only moved between directories
  3. All times are UTC - No timezone confusion
  4. Pastime = immediate - Any past timestamp triggers immediate publishing
  5. Directory-based metadata - All metadata embedded in directory names (timestamp_platform_account)

Quick Start

1. Create Content

Add content to content/approved/ with proper frontmatter:

---
title: "Your Article Title"
status: approved
---

Your content here...

2. Schedule Content

Create schedule file in calendar/schedules/:

week: 32
year: 2025
posts:
  - path: content/approved/article.md
    publish_date: 2025-08-08T14:30:00  # Future = scheduled
    platforms: linkedin:company, x:personal
  - path: content/approved/urgent.md
    publish_date: 2020-01-01T00:00:00  # Past = immediate
    platforms: linkedin:company

3. Automated Processing

  • Weekly: Schedule files processed automatically (Friday 8 AM UTC)
  • Every 20 minutes: Content in past-timestamp directories publishes automatically
  • Results: Content organized in published/ or failed/ by year/week

Workflow Phases

Phase 1: Schedule Processing

Triggers: Weekly cron, Git push, manual dispatch

  • Validates content exists with status: approved
  • Copies content to platform-specific directories: content/scheduled/YYYY-MM-DDTHH-MM-SSZ_platform_account/
  • Creates separate directory per platform (multi-platform content gets multiple directories)
  • Archives processed schedule

Phase 2: Content Enhancement (Optional)

Automated: Weekly (Monday 9 AM UTC), content changes, manual dispatch Local: make enhance-content updates files, you commit manually

  • Auto-detects suitable platforms for content based on analysis
  • Updates frontmatter with platforms_suitable field
  • GitHub workflow commits changes automatically
  • Creates GitHub issues for content optimization needs

Phase 3: Time-Based Publishing

Triggers: Every 20 minutes

  • Scans timestamped directories
  • Publishes content from past-timestamp directories
  • Sends JWT webhooks to n8n
  • Moves directories to published/ (success) or failed/ (failure)

Phase 4: Republishing Failed Content

Simple Directory-Based Recovery

  • Failed content stays in content/failed/YYYY-MM-DDTHH-MM-SSZ_platform_account/
  • To republish: Simply move the directory back to scheduled
  • System will automatically retry on next publishing cycle

Republishing Examples:

# Move specific failed content back to scheduled for immediate retry
mv content/failed/2025-08-14T15-45-00Z_x_personal/ content/scheduled/

# Schedule failed content for future time (optional - rename directory)
mv content/failed/2025-08-14T15-45-00Z_x_personal/ content/scheduled/2025-08-15T10-00-00Z_x_personal/

# Bulk republish all failed content
mv content/failed/*/ content/scheduled/

Why This Works:

  • Directory names contain all metadata (platform, account, content)
  • No external files to synchronize or update
  • Content and metadata move together atomically
  • System treats moved directories as new publishing attempts

Key Features

  • Time-Based Publishing - Directory timestamps control publishing
  • Immediate Publishing - Past timestamps publish immediately
  • Auto-Platform Detection - AI-powered platform suitability analysis
  • Automatic Metadata Enhancement - Frontmatter automatically updated with suitable platforms
  • Content Optimization Issues - GitHub issues created for platform compatibility problems
  • Simple Platform Files - Plain text instead of complex JSON
  • Organized Results - Automatic year/week organization
  • No Task Files - Directory structure IS the schedule
  • JWT Security - Signed webhooks to n8n
  • Rich Logging - Detailed publishing logs and validation reports

Company & Personal Context

  • Company Information: Context-Company.md - Detailed company, product, and brand information for corporate posting
  • Personal Information: Context-Personal.md - Personal context for individual account posting

Integration Capabilities

This system can be executed through:

  • Manual n8n/Zapier/Make automation workflows
  • AI agent tools like Claude Code
  • Autonomous Marketing Engine (AME) integration
  • GitHub Actions automation

What This System Doesn't Do

The Engagement Layer

This system automates content distribution, not community management. Social media requires two-way communication - the system doesn't handle:

  • Incoming comments or direct messages
  • Brand mentions monitoring
  • Community engagement

Recommended Addition: Implement a separate engagement workflow using social listening tools (Brand24, Mentionlytics) with AI-powered triage for human community management.

SMM Platform Integration

Consider integrating with open-source SMM platforms like Postiz or Mixpost as the publishing engine while focusing custom development on unique content generation and analytics.

Documentation

📚 docs/ - All documentation is organized in the docs directory

Key Documents

Growth Strategies

Monitoring System State

# What's pending?
ls content/scheduled/

# What published this week?
ls content/published/2025/week-32/

# Any failures?
ls content/failed/2025/week-32/

# Check logs
cat logs/publishing/2025/week-32/summary.json

This architecture embodies true "Content as Code" principles where the filesystem structure IS the application state, providing intuitive debugging, easy recovery, and Git-friendly operations.

About

Fully automated Social Posting using AI Chat assistant (Claude Code/Codex CLI), Github + Actions (PR/Merge), and n8n (can be used also with Zapier or Make)

Topics

Resources

Stars

Watchers

Forks

Contributors