A SERP-first, intent-first backlink content engine that generates publication-ready backlink articles with full traceability, quality control, and strict adherence to the Next-A1 framework.
This engine takes three simple inputs:
- Publisher domain (where content will be published)
- Target URL (the page receiving the backlink)
- Anchor text (the link text)
...and produces publication-ready backlink content with:
- Full SERP analysis and intent modeling
- Strategic bridge type recommendation (strong, pivot, wrapper)
- LSI-optimized content with proper anchor placement
- Trust source integration (T1-T4 hierarchy)
- Comprehensive QC validation
- Complete traceability and explainability
- Variabelgiftermål (Variable Marriage): Aligns publisher, anchor, target, and search intent
- SERP-First Approach: Drives content strategy from dominant SERP intent
- Bridge Types: Intelligent strategy selection (strong, pivot, wrapper)
- Trust Policy: T1→T2→T3→T4 source prioritization
- LSI Quality: 6-10 relevant terms within ±2 sentence window
- Autofix-Once: Single automatic correction attempt with loop protection
- Quality Control: Comprehensive validation against Next-A1 requirements
All components designed for reusability in other SEO tools:
- PageProfile: Reusable web scraping and profiling
- SERP Analysis: Intent classification and pattern extraction
- Intent Modeling: Publisher-anchor-target-SERP alignment
- QC System: Configurable quality validation
- Deterministic state machine (RECEIVE → PREFLIGHT → WRITE → QC → DELIVER)
- JSON schema validation
- Structured logging with full execution trace
- Mock mode for testing without API costs
- Comprehensive error handling and recovery
- Python 3.9+
- Anthropic API key (for Writer Engine)
- Optional: SERP API key (for real SERP data)
# Clone the repository
git clone <repository-url>
cd BACOWR
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Set environment variables
export ANTHROPIC_API_KEY="your-api-key-here"
# Optional:
export SERP_API_KEY="your-serp-api-key"Configuration files in config/:
thresholds.yaml: QC thresholds (LSI, readability, trust requirements)policies.yaml: Autofix policies and industry compliance rules
Schemas in schemas/:
next-a1-spec.json: Complete Next-A1 specificationbacklink_job_package.schema.json: BacklinkJobPackage JSON schema
python main.py \
--publisher example-publisher.com \
--target https://client.com/product \
--anchor "bästa valet för produktkategori"python main.py \
--publisher example-publisher.com \
--target https://client.com/product \
--anchor "best choice" \
--anchor-type partial \
--min-words 1200 \
--language sv \
--serp-mode mock \
--output ./output/ \
--log-level DEBUG| Option | Description | Default |
|---|---|---|
--publisher |
Publisher domain (required) | - |
--target |
Target URL (required) | - |
--anchor |
Anchor text (required) | - |
--anchor-type |
Anchor type hint: exact, partial, brand, generic | Auto-detect |
--min-words |
Minimum word count | 900 |
--language |
Language override (sv, en, etc.) | Auto-detect |
--output |
Output directory | ./storage/output |
--serp-mode |
SERP mode: mock or api | mock |
--serp-api-key |
SERP API key | $SERP_API_KEY |
--writer-api-key |
Anthropic API key | $ANTHROPIC_API_KEY |
--writer-model |
Claude model | claude-sonnet-4-5-20250929 |
--log-level |
Logging level | INFO |
--json-logs |
Output JSON-formatted logs | false |
The engine generates comprehensive output for each job:
storage/output/
└── <job-id>_article.md # The generated article
└── <job-id>_job_package.json # Complete job package
└── <job-id>_extensions.json # Next-A1 extensions
└── <job-id>_qc_report.json # QC validation results
└── <job-id>_execution_log.json # State machine trace
Article (*_article.md):
- Publication-ready backlink content in Markdown
- Structured with H1-H3 headings
- Strategic anchor placement
- LSI-optimized near-window
- Trust source integration
Job Package (*_job_package.json):
- Complete input data and analysis
- Publisher, target, and anchor profiles
- SERP research extension
- Intent extension
- Generation constraints
Extensions (*_extensions.json):
links_extension: Bridge type, anchor placement, LSI, trust, complianceintent_extension: Intent alignment, recommended bridge, required subtopicsqc_extension: Anchor risk, readability, signals usedserp_research_extension: SERP analysis data
QC Report (*_qc_report.json):
- Overall status: pass, warning, fail, needs_signoff
- Detailed issues with severity levels
- Autofix recommendations
- Human sign-off triggers
Execution Log (*_execution_log.json):
- Complete state machine trace
- Timestamps for each transition
- Success/failure indicators
- Debugging data
RECEIVE → PREFLIGHT → WRITE → QC → DELIVER
↓ ↓ ↓
ABORT ABORT RESCUE (AutoFixOnce)
States:
- RECEIVE: Accept input (publisher, target, anchor)
- PREFLIGHT: Assemble BacklinkJobPackage
- Profile target page
- Profile publisher site
- Classify anchor
- Select SERP queries
- Fetch and analyze SERP data
- Model intent alignment
- WRITE: Generate content with Writer Engine
- QC: Validate against Next-A1 requirements
- RESCUE: AutoFixOnce attempt (if fixable issues)
- DELIVER: Output successful result
- ABORT: Terminate on critical failure
Analysis Pipeline (src/modules/):
page_profile.py: Reusable web scraping and profilingtarget_profiler.py: Target page analysispublisher_profiler.py: Publisher site analysisanchor_classifier.py: Anchor text classificationquery_selector.py: SERP query generationserp_fetcher.py: SERP data fetching (mock/real)serp_analyzer.py: SERP intent and pattern analysisintent_modeler.py: Intent alignment and bridge strategy
Generation Pipeline (src/pipeline/):
job_assembler.py: BacklinkJobPackage assemblywriter_engine.py: LLM-based content generationstate_machine.py: Pipeline orchestration
Quality Control (src/qc/):
quality_controller.py: QC validation and AutoFixOnce
Utilities (src/utils/):
logger.py: Structured loggingvalidation.py: JSON schema validation
The core principle: Content must marry four dimensions:
- Publisher (publication site role and voice)
- Anchor (link text and implied intent)
- Target (destination page offer)
- Intent (dominant SERP search intent)
Strong Bridge:
- Direct, natural connection
- All dimensions aligned
- Publisher niche overlap ≥ 0.7
- Trust requirement: 1 source
Pivot Bridge:
- Thematic bridge strategy
- Partial alignment
- Publisher niche overlap 0.4-0.7
- Trust requirement: 1-2 sources
Wrapper Bridge:
- Meta-frame strategy
- Low alignment (overall=off acceptable)
- Build neutral frame (methodology, risk, comparison)
- Trust requirement: 2-3 sources for triangulation
Source prioritization (T1 → T2 → T3 → T4):
- T1: Government, official standards
- T2: Academic, peer-reviewed research
- T3: Industry organizations, whitepapers
- T4: Reputable media (fallback only)
Constraints:
- Never link to direct competitors
- Prefer Swedish sources for SE markets
- Use PLATSFÖRSLAG placeholder if source unknown
- Count: 6-10 relevant terms
- Window: ±2 sentences around link
- Quality: Entity cluster diversity, not just synonyms
- Sourcing: From target entities + SERP subtopics
- Forbidden: Never in H1 or H2
- Preferred: Middle section (H2 section 2-3)
- Paragraph: First or second paragraph in section
- Context: After establishing theme, before CTA
# Install test dependencies
pip install pytest pytest-cov
# Run all tests
pytest
# Run with coverage
pytest --cov=src tests/
# Run specific test
pytest tests/test_pipeline_smoke.py -vFor testing without API costs, use --serp-mode mock:
- Generates realistic synthetic SERP data
- No Writer Engine calls (requires API key anyway)
- Full pipeline validation
This engine is designed for reuse across multiple SEO tools:
PageProfile Module:
- Web scraping and content extraction
- Language detection and entity extraction
- Can power: content audits, competitive analysis, link analysis
SERP Analysis:
- Intent classification
- Pattern extraction
- Page archetype detection
- Can power: keyword research, content gap analysis, rank tracking
Intent Modeling:
- Publisher-target-anchor alignment
- Content strategy recommendation
- Can power: content planning, editorial calendars, topic clustering
QC System:
- Configurable quality validation
- Autofix logic framework
- Can power: content QA tools, style checkers
As a Library:
from src.pipeline.job_assembler import BacklinkJobAssembler
from src.pipeline.writer_engine import WriterEngine
# Assemble job package
assembler = BacklinkJobAssembler(serp_mode="api")
job_package, valid, error = assembler.assemble_job_package(
publisher_domain="example.com",
target_url="https://target.com",
anchor_text="best solution"
)
# Generate content
writer = WriterEngine(api_key="...")
article, extensions, success, error = writer.generate_content(job_package)As a Service:
- The state machine can be wrapped in a REST API
- Job packages can be queued for async processing
- Results can be stored in a database for analytics
- ✅ Complete Next-A1 implementation
- ✅ Full pipeline (RECEIVE → DELIVER)
- ✅ QC validation
- ✅ Mock SERP support
- ✅ CLI interface
- ✅ Comprehensive documentation
- Real SERP Integration: Connect to SerpApi/Serper
- AutoFix Implementation: Complete autofix logic for all issue types
- Enhanced LLM Prompts: Refine writer prompts for better output
- Testing: Expand test coverage
- Web UI: Build frontend interface with Figma
- Analytics Dashboard: Track job success rates, QC patterns
- Database Integration: Store results for historical analysis
- MCP Integration: Build MCP server for external tool integration
- Advanced NER for better entity extraction
- ML-based intent classification
- Semantic clustering for topic modeling
- SERP feature extraction (PAA, featured snippets)
- Historical SERP tracking
- Multi-language optimization
- A/B testing framework for content variants
Import Errors:
# Make sure you're in the project root and venv is activated
source venv/bin/activate
pip install -r requirements.txtAPI Key Errors:
# Set environment variable
export ANTHROPIC_API_KEY="your-key-here"
# Or pass as argument
python main.py --writer-api-key "your-key-here" ...SERP Fetch Failures:
- Use
--serp-mode mockfor testing - Check SERP API key if using
--serp-mode api - Review logs with
--log-level DEBUG
QC Failures:
- Check
*_qc_report.jsonfor detailed issues - Review recommendations for fixes
- Adjust thresholds in
config/thresholds.yamlif needed
This is a standalone project designed for production use and extensibility.
Guidelines:
- Follow existing code style (Black formatting)
- Add tests for new features
- Update documentation
- Keep modules focused and reusable
- Maintain Next-A1 compliance
[To be determined]
For questions, issues, or collaboration:
- Open an issue on GitHub
- [Contact information]
Built with Next-A1 Framework SERP-First. Intent-First. Production-Ready.
Backlink Article Content Orchestration With Refinement
Ett ramverk för automatiserad, SERP-driven länkinnehållsproduktion baserat på Next-A1 specifikationen.
BACOWR är en produktionsklar motor för att skapa högkvalitativa backlink-artiklar som:
- ✅ Analyserar SERP för intent och toppresultat
- ✅ Profilerar målsida och publisher automatiskt
- ✅ Genererar backlink-innehåll som naturligt passar SERP-landskapet
- ✅ Validerar kvalitet med inbyggd QC (Quality Control)
- ✅ Exporterar till Google Sheets/Docs för enkel delning och överblick
- ✅ Loggar hela processen för spårbarhet
Motorn kräver endast tre inputs:
{
"publisher_domain": "example-publisher.com",
"target_url": "https://client.com/product-x",
"anchor_text": "bästa valet för [tema]"
}Därifrån sker allt annat automatiskt.
BACOWR/
├── config/
│ ├── thresholds.yaml # ✅ QC-regler och tröskelvärden
│ └── policies.yaml # ✅ AutoFix policies och blocking conditions
├── src/
│ ├── __init__.py
│ ├── api.py # ✅ Main API: run_backlink_job() (mock)
│ ├── production_api.py # ✅ Production API with full LLM integration
│ ├── qc/
│ │ ├── __init__.py
│ │ ├── models.py # ✅ QCReport, QCIssue, AutoFixLog
│ │ └── quality_controller.py # ✅ Komplett QC-system
│ ├── engine/
│ │ ├── __init__.py
│ │ ├── state_machine.py # ✅ State machine med loop-skydd
│ │ └── execution_logger.py # ✅ Execution logging
│ ├── profiling/
│ │ ├── __init__.py
│ │ ├── page_profiler.py # ✅ URL profiling (target & publisher)
│ │ └── llm_enhancer.py # ✅ LLM-enhanced profiling
│ ├── research/
│ │ ├── __init__.py
│ │ ├── serp_researcher.py # ✅ Mock SERP researcher
│ │ └── ahrefs_serp.py # ✅ Ahrefs Enterprise API integration
│ ├── analysis/
│ │ ├── __init__.py
│ │ └── intent_analyzer.py # ✅ Intent alignment analysis
│ ├── writer/
│ │ ├── __init__.py
│ │ ├── writer_engine.py # ✅ Mock writer for testing
│ │ └── production_writer.py # ✅ Multi-LLM production writer
│ └── export/
│ ├── __init__.py
│ ├── README.md # ✅ Complete export documentation
│ ├── google_auth.py # ✅ Google OAuth & Service Account auth
│ ├── google_sheets_exporter.py # ✅ Export to Google Sheets
│ └── google_docs_exporter.py # ✅ Export to Google Docs
├── tests/
│ ├── test_schema_validation.py # ✅ JSON Schema-validering
│ ├── test_live_validation.py # ✅ Live E2E-validering
│ ├── test_qc_system.py # ✅ QC-tester (Del 3A)
│ ├── test_e2e_mock.py # ✅ E2E mock pipeline-tester
│ ├── test_page_profiler.py # ✅ PageProfiler tests (14/14)
│ ├── test_serp_researcher.py # ✅ SERP tests (14/14)
│ ├── test_intent_analyzer.py # ✅ Intent tests (26/26)
│ └── test_writer_engine.py # ✅ Writer tests (12/12)
├── api/
│ ├── app/
│ │ ├── main.py # ✅ FastAPI application
│ │ ├── database.py # ✅ SQLAlchemy database setup
│ │ ├── models/ # ✅ Database models & schemas
│ │ ├── routes/ # ✅ API endpoints
│ │ │ ├── jobs.py # ✅ Job management
│ │ │ ├── backlinks.py # ✅ Backlink tracking
│ │ │ ├── analytics.py # ✅ Analytics & metrics
│ │ │ ├── export.py # ✅ Google Sheets/Docs export
│ │ │ └── ...
│ │ └── services/ # ✅ Business logic services
│ └── README.md # ✅ API documentation
├── examples/
│ ├── example_job_package.json # ✅ Referens-implementation
│ ├── batch_jobs_example.csv # ✅ Example batch CSV
│ ├── batch_jobs_example.json # ✅ Example batch JSON
│ └── export_integration_example.py # ✅ Google export integration demo
├── storage/
│ ├── output/ # ✅ Single job outputs
│ ├── batch_output/ # ✅ Batch processing outputs
│ └── batch_chunks/ # ✅ Scheduled batch chunks
├── backlink_job_package.schema.json # ✅ JSON Schema (single source of truth)
├── BacklinkJobPackage.json # ✅ Original exempel-jobb
├── backlink_engine_ideal_flow.md # ✅ Idealflöde dokumentation
├── next-a1-spec.json # ✅ Next-A1 specifikation
├── NEXT-A1-ENGINE-ADDENDUM.md # ✅ Del 2 tillägg och krav
├── PRODUCTION_GUIDE.md # ✅ Complete production guide
├── BATCH_GUIDE.md # ✅ Complete batch processing guide
├── main.py # ✅ CLI entrypoint (mock)
├── production_main.py # ✅ Production CLI with LLM
├── batch_runner.py # ✅ Batch processing CLI
├── batch_monitor.py # ✅ Batch monitoring dashboard
├── batch_scheduler.py # ✅ Batch scheduling utility
├── cost_calculator.py # ✅ Cost estimation tool
├── quickstart.py # ✅ Interactive quick start guide
├── .env.example # ✅ Configuration template
├── requirements.txt # ✅ Python dependencies
└── README.md # Denna fil
När motorn körs i mock-mode (redo nu) produceras:
{job_id}_job_package.json– Komplett BacklinkJobPackage{job_id}_article.md– Genererad backlink-artikel (≥900 ord){job_id}_qc_report.json– QC-rapport med issues och AutoFix-logs{job_id}_execution_log.json– State machine-spårning
Alla filer sparas i storage/output/ (konfigurerbart).
- Python 3.9+
- pip
# 1. Klona repot
git clone https://github.com/robwestz/BACOWR.git
cd BACOWR
# 2. Skapa virtuell miljö
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# 3. Installera beroenden
pip install -r requirements.txt
# 4. Kopiera och redigera .env
cp .env.example .env
# Lägg till dina API-nycklar i .env (valfritt för dev-läge)
# 5. Kör BACOWR
python run_bacowr.py --mode dev \
--publisher example.com \
--target https://example.com/page \
--anchor "test link"# Unix/Linux/macOS
./start_bacowr.sh
# Windows
.\start_bacowr.ps1These scripts automatically set up the virtual environment and install dependencies.
The new run_bacowr.py provides a single, simple entry point for all modes:
# Development mode (uses mock data, no API keys needed)
python run_bacowr.py --mode dev \
--publisher example.com \
--target https://example.com/page \
--anchor "example link"
# Production mode (requires LLM API key)
export ANTHROPIC_API_KEY='your-key-here'
python run_bacowr.py --mode prod \
--publisher aftonbladet.se \
--target https://sv.wikipedia.org/wiki/Artificiell_intelligens \
--anchor "läs mer om AI"
# Interactive demo
python run_bacowr.py --mode demo# Unix/Linux/macOS
./start_bacowr.sh # Runs in dev mode
./start_bacowr.sh --mode prod # Runs in production mode
# Windows
.\start_bacowr.ps1 # Runs in dev mode
.\start_bacowr.ps1 -Mode prod # Runs in production mode# Set API key
export ANTHROPIC_API_KEY='your-key-here'
# Run interactive guide
python run_bacowr.py --mode demo --demo-type quickstartThis will guide you through generating your first article step-by-step.
Generate a single article in production mode:
# Using run_bacowr.py (recommended)
python run_bacowr.py --mode prod \
--publisher aftonbladet.se \
--target https://sv.wikipedia.org/wiki/Artificiell_intelligens \
--anchor "läs mer om AI" \
--llm anthropic \
--strategy multi_stage
# Or using legacy script (still supported)
python production_main.py \
--publisher aftonbladet.se \
--target https://sv.wikipedia.org/wiki/Artificiell_intelligens \
--anchor "läs mer om AI" \
--llm anthropic \
--strategy multi_stageOutput:
- Article generated in ~30-60 seconds
- QC report with quality validation
- Full job package with profiling data
- Execution log for debugging
Process multiple articles efficiently:
# Create batch input file (jobs.csv)
cat > jobs.csv << EOF
publisher,target,anchor,strategy
aftonbladet.se,https://example.com/page1,anchor 1,multi_stage
svd.se,https://example.com/page2,anchor 2,single_shot
EOF
# Run batch (sequential)
python batch_runner.py --input jobs.csv
# Run batch with parallel processing
python batch_runner.py --input jobs.csv --parallel 3 --rate-limit 10
# Monitor progress
python batch_monitor.py --watch storage/batch_output/See BATCH_GUIDE.md for comprehensive batch processing documentation.
Estimate costs before running:
# Estimate single job
python cost_calculator.py --jobs 1 --provider anthropic --strategy multi_stage
# Estimate batch file
python cost_calculator.py --input jobs.csv --details# Copy .env.example to .env and add your API keys
cp .env.example .env
# Edit .env with your actual API keys
# Start services
docker-compose up --build
# The API will be available at http://localhost:8000
# API documentation at http://localhost:8000/docs# Build image
docker build -t bacowr .
# Run in production mode
docker run --env-file .env bacowr \
python run_bacowr.py --mode prod \
--publisher example.com \
--target https://example.com \
--anchor "test link"
# Run API server
docker run -p 8000:8000 --env-file .env bacowr \
python -m uvicorn api.app.main:app --host 0.0.0.0 --port 8000Kör full pipeline i mock-mode (ingen extern API krävs):
# New unified entry point
python run_bacowr.py --mode dev \
--publisher example-publisher.com \
--target https://client.com/product-x \
--anchor "bästa valet för [tema]"
# Or using legacy script
python main.py \
--publisher example-publisher.com \
--target https://client.com/product-x \
--anchor "bästa valet för [tema]" \
--mockOutput:
======================================================================
BACOWR - BacklinkContent Engine (Next-A1)
======================================================================
Publisher: example-publisher.com
Target: https://client.com/product-x
Anchor: bästa valet för [tema]
Mode: MOCK
----------------------------------------------------------------------
Job ID: job_20251107_110356_abc123
Status: BLOCKED
QC Report:
Status: BLOCKED
Issues: 2
AutoFix: Yes
Human Signoff Required: No
Output Files:
- job_package: storage/output/job_..._job_package.json
- article: storage/output/job_..._article.md
- qc_report: storage/output/job_..._qc_report.json
- execution_log: storage/output/job_..._execution_log.json
from src.api import run_backlink_job
result = run_backlink_job(
publisher_domain="example-publisher.com",
target_url="https://client.com/product-x",
anchor_text="bästa valet för [tema]",
mock=True # Mock mode - no external APIs
)
# result innehåller:
# - job_id: str
# - status: 'DELIVERED' | 'BLOCKED' | 'ABORTED'
# - job_package: dict
# - article: str
# - qc_report: dict
# - execution_log: dict
# - output_files: dict (paths till sparade filer)Alla tester körs utan externa dependencies:
python tests/test_schema_validation.pyValiderar BacklinkJobPackage mot JSON Schema.
python tests/test_live_validation.pyValiderar datakvalitet, språk-konsistens, intent alignment.
python tests/test_qc_system.py7 tester:
- LSI requirements check
- Trust sources validation
- Anchor risk assessment
- Link placement rules
- Full QC validation
- AutoFixOnce limit enforcement
- Blocking conditions
python tests/test_e2e_mock.py7 tester:
- Full pipeline execution
- State machine transitions
- QC integration
- Output file generation
- Loop detection
- Job package schema validation
- RESCUE max once verification
python tests/test_schema_validation.py && \
python tests/test_live_validation.py && \
python tests/test_qc_system.py && \
python tests/test_e2e_mock.pyFörväntat resultat: ✅ Alla tester passar
Quality Control-systemet har två nivåer:
Vid mindre avvikelser görs exakt EN automatisk fix:
- Flytta länk inom samma sektion
- Justera ankartyp (exact → brand/generic)
- Injicera saknade LSI (inom policy)
- Lägga till compliance-disclaimers
Alla ändringar loggas i qc_report.json → autofix_logs.
Konfiguration: config/policies.yaml
Vid allvarliga avvikelser blockeras delivery och kräver human signoff:
- Intent alignment: "off"
- Trust-källor: 0 godkända
- Konkurrent-detektion i content
- Reglerad vertikal utan disclaimers
- Ankar-risk: "high"
Sätter human_signoff_required: true i QC-rapport.
Konfiguration: config/thresholds.yaml
Se config/thresholds.yaml för komplett regeluppsättning:
- LSI: 6-10 termer, ±2 meningar från länk
- Trust sources: T1-T4 tiers, minst 1 T1-källa
- Anchor risk: High/Medium/Low patterns
- Link placement: Ej H1/H2, mittsektion preferred
- Word count: Minimum 900 ord
- Compliance: Disclaimers för reglerade vertikaler (gambling, finance, health, legal)
Varje körning går genom följande states:
RECEIVE → PREFLIGHT → WRITE → QC → DELIVER
↓ (on QC fail)
RESCUE (max 1 gång)
↓
QC → DELIVER or ABORT
Loop-skydd:
- Payload hashas efter WRITE och RESCUE
- Om identisk → ABORT (ingen förändring)
RESCUE-policy:
- Max 1 försök per körning
- Endast vid auto-fixable issues
- Vid human_signoff_required → direkt ABORT
Spårbarhet:
Alla state-övergångar loggas i execution_log.json:
{
"metadata": {
"job_id": "job_...",
"started_at": "2025-11-07T10:30:00Z",
"completed_at": "2025-11-07T10:30:05Z",
"final_state": "DELIVER"
},
"log_entries": [
{
"type": "state_transition",
"timestamp": "...",
"from_state": "RECEIVE",
"to_state": "PREFLIGHT"
},
...
]
}-
- Detaljerat idealflöde från input till output
- Beskriver alla profileringar och extensions
-
- Formella krav för Del 2 & 3
- QC & AutoFixOnce specifikation
- State machine krav
- Acceptance-kriterier
-
- Komplett Next-A1 specifikation
- Intent-klassificering
- Bridge-typer
- Länkplacering och ankarpolicies
Single Source of Truth: backlink_job_package.schema.json
Detta schema definierar det bindande kontraktet för BacklinkJobPackage.
Obligatoriska toppnivå-fält:
job_meta– Metadata (job_id, created_at, spec_version)input_minimal– Tre inputs (publisher, target, anchor)publisher_profile– Profilerad publishersidatarget_profile– Profilerad målsidaanchor_profile– Ankaranalysserp_research_extension– SERP-research (main + cluster queries)intent_extension– Intent-modellering och alignmentgeneration_constraints– Generationspolicies (språk, ordkrav, etc)
Per NEXT-A1-ENGINE-ADDENDUM.md § 7:
-
test_schema_validation.pypasserar ✅ -
test_live_validation.pypasserar ✅ - README beskriver struktur och användning ✅
- QC-system implementerat med AutoFixOnce ✅
- State machine loggar till
execution_log✅ - CLI och Python API fungerar ✅
- Mock-mode tillåter testing utan externa deps ✅
-
test_qc_system.pypasserar (7/7 tester) ✅ -
test_e2e_mock.pypasserar (7/7 tester) ✅ - README uppdaterad med Del 3A ✅
- PageProfiler kan extrahera från URLs ✅
- SERP Researcher kan fetcha & analysera SERP (Ahrefs + mock) ✅
- Intent Analyzer bygger intent_extension ✅
- Writer Engine genererar artiklar med LLM ✅
- Multi-provider LLM support (Claude, GPT, Gemini) ✅
- Multi-stage & single-shot strategies ✅
- Bridge types (strong/pivot/wrapper) implementerade ✅
- LSI-injection fungerar ✅
- LLM-enhanced profiling (anchor, entities, tone) ✅
- Full E2E-test med riktiga inputs ✅
- Batch processing system ✅
- Cost tracking and optimization ✅
- Minst 1–2 manuella produktionskörningar genomförda
- Performance-tuning baserat på verklig användning
- Deployment-guide och best practices dokumenterade
Version: 1.0.0-beta
| Komponent | Status | Tester | Dokumentation |
|---|---|---|---|
| JSON Schema | ✅ Klar | ✅ 2/2 | ✅ Komplett |
| QC System | ✅ Klar | ✅ 7/7 | ✅ Komplett |
| State Machine | ✅ Klar | ✅ 7/7 | ✅ Komplett |
| Execution Logger | ✅ Klar | ✅ 7/7 | ✅ Komplett |
| CLI & API | ✅ Klar (production) | ✅ 7/7 | ✅ Komplett |
| PageProfiler | ✅ Klar | ✅ 14/14 | ✅ Komplett |
| SERP Researcher | ✅ Klar (Ahrefs) | ✅ 14/14 | ✅ Komplett |
| Writer Engine | ✅ Klar (Multi-LLM) | ✅ 12/12 | ✅ Komplett |
| Intent Analyzer | ✅ Klar | ✅ 26/26 | ✅ Komplett |
| LLM Enhancer | ✅ Klar | ✅ Testad | ✅ Komplett |
| Batch Runner | ✅ Klar | ✅ Testad | ✅ BATCH_GUIDE.md |
| Batch Monitor | ✅ Klar | - | ✅ BATCH_GUIDE.md |
| Batch Scheduler | ✅ Klar | - | ✅ BATCH_GUIDE.md |
Del 3A: ✅ Komplett och testad (80/80 tester passerar) Del 3B: ✅ Komplett och produktionsklar (Live-testad med Claude Haiku)
Total test coverage: 80 passing tests
Motorn är utformad för att vara integrationsklar utan hårda beroenden.
- MCP-verktyg (Model Context Protocol)
- Batch-processer för stora uppdrag
- GUI/Dashboard för manuell körning
- CI/CD pipelines för automatisk content-generering
Inga antaganden görs om externa orchestrators. Mock-mode tillåter testning av full pipeline utan externa API:er.
Se examples/example_job_package.json för ett komplett exempel på BacklinkJobPackage.
Exempel visar:
- Svensk publisher (consumer_magazine tone)
- Kommersiell målsida (Product X)
- Partial anchor med commercial_research intent
- Aligned intent mellan SERP, target och publisher
- Pivot bridge-type rekommenderad
# 1. Klona och installera
git clone https://github.com/robwestz/BACOWR.git
cd BACOWR
pip install -r requirements.txt
# 2. Kör tester för att verifiera installation
python tests/test_qc_system.py
python tests/test_e2e_mock.py
# 3. Kör pipeline i mock-mode
python main.py \
--publisher test.com \
--target https://example.com \
--anchor "test link" \
--mock \
--verbose
# 4. Inspektera output
ls -la storage/output/
cat storage/output/job_*_qc_report.json
cat storage/output/job_*_article.mdProblem: Mock-artiklar innehåller ofta inte tillräckligt med trust-källor eller LSI-termer.
Förväntat beteende: QC ska blockera vid brister - detta visar att systemet fungerar korrekt.
Lösning för produktion: Implementera Del 3B (Writer Engine med LLM) som genererar fullständiga artiklar.
# Verifiera installation
pip install -r requirements.txt
# Kör tester individuellt för att isolera problem
python tests/test_schema_validation.py
python tests/test_qc_system.py(Lägg till din licens här)
(Lägg till bidragsinstruktioner här)
För frågor eller buggrapporter, öppna en issue i GitHub-repot: https://github.com/robwestz/BACOWR/issues
Version: 1.0.0-beta (Del 3A & 3B Komplett) Status: Production Ready with Full LLM Integration & Batch Processing Last Updated: 2025-11-07
BACOWR supports multiple LLM providers with automatic fallback:
| Provider | Models Supported | Features |
|---|---|---|
| Anthropic Claude | Haiku, Sonnet, Opus | ✅ Tested & Working |
| OpenAI GPT | GPT-4o, GPT-4o-mini, GPT-4-turbo | ✅ Integrated |
| Google Gemini | Flash, Pro 1.5, Pro 1.0 | ✅ Integrated |
# Set at least one API key
export ANTHROPIC_API_KEY='sk-ant-...'
export OPENAI_API_KEY='sk-proj-...'
export GOOGLE_API_KEY='...'
# Optional: Ahrefs for real SERP data
export AHREFS_API_KEY='...'See .env.example for complete configuration options.
- Multi-Stage (Best Quality): 3 LLM calls (outline → content → polish)
- Single-Shot (Fast): 1 LLM call, optimized prompt
Choose strategy based on quality vs. speed requirements.
Process hundreds of articles efficiently with:
- CSV/JSON input for batch job definitions
- Parallel processing with configurable workers
- Rate limiting to respect API quotas
- Cost tracking and estimation
- Live monitoring dashboard
- Scheduled batches for off-peak processing
Example:
# Process 100 articles overnight
python batch_scheduler.py \
--input large_batch.csv \
--chunk-size 25 \
--time 23:00 \
--interval 15 \
--parallel 2 \
--rate-limit 10See BATCH_GUIDE.md for complete documentation.