| name | anna-archive |
| description | Anna's Archive integration for academic paper and book retrieval. Search shadow libraries (Library Genesis, Z-Library, Sci-Hub) via unified API with GF(3) balanced caching. |
| metadata | {"trit":0,"version":"1.0.0","bundle":"research"} |
Anna's Archive Skill
Trit: 0 (ERGODIC - coordinates retrieval across sources)
Foundation: Anna's Archive API + academic-research skill
Principle: Unified access to shadow libraries for research
Overview
Anna's Archive is a search engine for shadow libraries:
- Library Genesis (LibGen) - books and papers
- Z-Library - ebooks
- Sci-Hub - academic papers
- Internet Archive - open library
This skill integrates with the ANNA_SELF token for authenticated access.
Configuration
export ANNA_SELF="your_anna_archive_key"
API Reference
Search Operations
const ArchiveOfAnna = require('archive_of_anna');
const results = await ArchiveOfAnna.search({
text: "category theory",
lang: "en",
content: "book_nonfiction",
ext: "pdf",
sort: "newest"
});
Content Fetching
const content = await ArchiveOfAnna.fetch_by_md5("abc123...");
Babashka Integration
#!/usr/bin/env bb
;; anna-search.bb - Search Anna's Archive
(require '[babashka.http-client :as http]
'[cheshire.core :as json])
(def anna-self (System/getenv "ANNA_SELF"))
(defn anna-search [query & {:keys [lang ext limit]
:or {lang "en" ext "pdf" limit 10}}]
(let [base-url "https://annas-archive.org/search"
params {:q query :lang lang :ext ext}]
;; Note: Anna's Archive doesn't have official API
;; This would scrape or use unofficial wrapper
(println (format "Searching Anna's Archive: %s" query))
{:query query :params params}))
(defn fetch-by-md5 [md5]
(let [url (format "https://annas-archive.org/md5/%s" md5)]
(println (format "Fetching: %s" url))
{:md5 md5 :url url}))
;; GF(3) balanced search: 3 queries in parallel
(defn triadic-search [queries]
(let [results (pmap anna-search queries)
trits (cycle [-1 0 1])]
{:searches (map #(assoc %1 :trit %2) results trits)
:gf3-sum (reduce + (take (count queries) trits))}))
(when (= *file* (System/getProperty "babashka.file"))
(let [query (or (first *command-line-args*) "category theory")]
(println (anna-search query))))
Python Integration
"""anna_archive.py - Anna's Archive Python client"""
import os
import httpx
from bs4 import BeautifulSoup
from dataclasses import dataclass
from typing import List, Optional
ANNA_SELF = os.getenv("ANNA_SELF")
BASE_URL = "https://annas-archive.org"
@dataclass
class SearchResult:
title: str
authors: List[str]
md5: str
extension: str
filesize: str
trit: int = 0
def search(
query: str,
lang: str = "en",
ext: str = "pdf",
content: str = "book_nonfiction"
) -> List[SearchResult]:
"""Search Anna's Archive."""
url = f"{BASE_URL}/search"
params = {
"q": query,
"lang": lang,
"ext": ext,
"content": content
}
print(f"Searching: {query}")
[]
() -> :
url =
{
: md5,
: url,
: [, , ]
}
() -> :
trits = [-, , ]
results = []
i, q (queries[:]):
result = search(q)
r result:
r.trit = trits[i % ]
results.extend(result)
trit_sum = (trits[:(queries)])
{
: results,
: trit_sum,
: trit_sum % ==
}
Ruby Integration
require 'httpx'
require 'nokogiri'
module AnnaArchive
ANNA_SELF = ENV['ANNA_SELF']
BASE_URL = 'https://annas-archive.org'
class << self
def search(query, lang: 'en', ext: 'pdf', content: 'book_nonfiction')
url = "#{BASE_URL}/search"
params = { q: query, lang: lang, ext: ext, content: content }
puts "Searching Anna's Archive: #{query}"
[]
end
def fetch_by_md5(md5)
url = "#{BASE_URL}/md5/#{md5}"
{ md5: md5, url: url }
end
def triadic_search(queries)
trits = [-1, 0, 1].cycle
results = queries.take().map.with_index ||
{ q, trits., search(q) }
sum = results.sum { || r[] }
{ results, sum, sum % == }
Integration with academic-research Skill
;; Combine with academic-research for comprehensive search
(defn comprehensive-search [query]
(let [;; Academic sources (via academic-research skill)
arxiv-results (arxiv-search query)
semantic-results (semantic-scholar-search query)
;; Shadow libraries (via anna-archive skill)
anna-results (anna-search query)
;; Triadic assignment
all-results [{:source :arxiv :trit -1 :results arxiv-results}
{:source :semantic-scholar :trit 0 :results semantic-results}
{:source :anna-archive :trit 1 :results anna-results}]]
{:triadic all-results
:gf3-sum (reduce + (map :trit all-results))
:total-count (reduce + (map #(count (:results %)) all-results))}))
DuckDB Caching
CREATE TABLE IF NOT EXISTS anna_cache (
md5 VARCHAR PRIMARY KEY,
title VARCHAR,
authors VARCHAR[],
extension VARCHAR,
filesize VARCHAR,
download_links JSON,
trit TINYINT,
cached_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO anna_cache (md5, title, authors, extension, trit)
VALUES ('abc123', 'Category Theory', ARRAY['Mac Lane'], 'pdf', 0);
SELECT trit, COUNT(*) as count
FROM anna_cache
GROUP BY trit
ORDER BY trit;
CLI Usage
bb anna-search.bb "category theory"
bb anna-search.bb "homotopy type theory" --lang en --ext pdf
bb anna-fetch.bb abc123def456
bb anna-triadic.bb "category theory" "type theory" "topos theory"
Content Types
| Content Type | Description | Trit |
|---|
book_nonfiction | Academic books | 0 |
book_fiction | Fiction books | +1 |
journal_article | Papers/articles | -1 |
magazine | Magazines | 0 |
comic | Comics | +1 |
standards | Standards docs | -1 |
GF(3) Triads
academic-research (-1) ⊗ anna-archive (0) ⊗ depth-search (+1) = 0 ✓
mathpix-ocr (-1) ⊗ anna-archive (0) ⊗ pdf (+1) = 0 ✓
sheaf-cohomology (-1) ⊗ anna-archive (0) ⊗ topos-generate (+1) = 0 ✓
Legal Notice
Anna's Archive indexes content from various sources. Users are responsible for complying with copyright laws in their jurisdiction. This skill is for research and educational purposes.
References
Autopoietic Marginalia
The interaction IS the skill improving itself.
Every use of this skill is an opportunity for worlding:
- MEMORY (-1): Record what was learned
- REMEMBERING (0): Connect patterns to other skills
- WORLDING (+1): Evolve the skill based on use
Add Interaction Exemplars here as the skill is used.