Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/complete-agi-core / seferim/seferim-autonomous-simple.sh |
| Date | Not specified in source |
| Repository | Janady13/complete-agi-core |
| Revision | 223c58f8857eb60c4d020e6d6feacdbfb482d71d |
| Branch | main |
| Path or archive member | seferim/seferim-autonomous-simple.sh |
| Original SHA-256 | ee038b61529ce793cda21893f2af12c86f80af1acb111b8925a5730db5db5326 |
| Git blob SHA | 42b316aaca387515a28a9b0298d5280b19f8bf43 |
| Reading-copy SHA-256 | ee038b61529ce793cda21893f2af12c86f80af1acb111b8925a5730db5db5326 |
Every recorded occurrence
These 2 records contain identical original source bytes. Their paths and revisions remain part of the archive.
| Original record | Branch or archive | Revision / identifier | Original location |
|---|---|---|---|
| Janady13/complete-agi-core / seferim/seferim-autonomous-simple.sh | main | 223c58f8857eb60c4d020e6d6feacdbfb482d71d | Open original |
| Janady13/complete-agi-core / seferim/seferim-autonomous-simple.sh | claude/improve-math-logic-ehIW1 | 33aa84f2aa61cedbe010240ada7f4efbdfe795a7 | Open original |
Recovered source transcript
Download complete source text ↓214 lines · 9.3 KB
#!/bin/bash
# =============================================================================
# SEFERIM AUTONOMOUS LEARNER - MacBook 2 (Simple Version)
# Works without jq or associative arrays
# Uses unified learning storage shared with MB1 via iCloud
# =============================================================================
LOG=~/.seferim/logs/learner.log
LEARNED_DIR=~/.seferim/learned
ICLOUD_LEARNED="$HOME/Library/Mobile Documents/com~apple~CloudDocs/AGI_Data/learned/macbook2"
UA="SEFERIM-AGI/2.0"
mkdir -p "$LEARNED_DIR" "$ICLOUD_LEARNED" ~/.seferim/logs 2>/dev/null
# =============================================================================
# AVAILABLE SOURCES
# =============================================================================
SOURCES="wikipedia arxiv semanticscholar pubmed github hackernews duckduckgo crossref openlibrary"
# =============================================================================
# TOPIC POOLS
# =============================================================================
TECH_TOPICS="machine_learning distributed_systems quantum_computing neural_networks cryptography compiler_design database_optimization kubernetes rust_programming WebAssembly"
SCIENCE_TOPICS="neuroscience quantum_physics molecular_biology climate_science astrophysics genetics artificial_intelligence cognitive_science materials_science bioinformatics"
PHILOSOPHY_TOPICS="consciousness epistemology philosophy_of_mind ethics metaphysics phenomenology decision_theory game_theory logic emergence"
MATH_TOPICS="category_theory topology number_theory graph_theory probability linear_algebra calculus discrete_mathematics combinatorics optimization"
# =============================================================================
# FETCH FUNCTIONS
# =============================================================================
fetch_wikipedia() {
local topic=$(echo "$1" | sed 's/_/%20/g')
curl -s --max-time 10 "https://en.wikipedia.org/w/api.php?action=query&titles=$topic&prop=extracts&exintro=1&explaintext=1&format=json" \
-H "User-Agent: $UA" 2>/dev/null | sed 's/.*"extract":"\([^"]*\)".*/\1/' | head -c 800
}
fetch_arxiv() {
local query=$(echo "$1" | sed 's/_/+/g')
local result=$(curl -s --max-time 15 "http://export.arxiv.org/api/query?search_query=all:$query&start=0&max_results=1" -H "User-Agent: $UA" 2>/dev/null)
local title=$(echo "$result" | sed -n 's/.*<title>\([^<]*\)<\/title>.*/\1/p' | head -2 | tail -1)
local summary=$(echo "$result" | sed -n 's/.*<summary>\([^<]*\)<\/summary>.*/\1/p' | head -1 | head -c 500)
echo "$title: $summary"
}
fetch_semanticscholar() {
local query=$(echo "$1" | sed 's/_/%20/g')
curl -s --max-time 10 "https://api.semanticscholar.org/graph/v1/paper/search?query=$query&limit=1&fields=title,abstract" \
-H "User-Agent: $UA" 2>/dev/null | sed 's/.*"title":"\([^"]*\)".*"abstract":"\([^"]*\)".*/\1: \2/' | head -c 800
}
fetch_pubmed() {
local query=$(echo "$1" | sed 's/_/+/g')
local ids=$(curl -s --max-time 8 "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=$query&retmax=1&retmode=json" 2>/dev/null | sed 's/.*"idlist":\["\([^"]*\)".*/\1/')
if [ -n "$ids" ] && [ "$ids" != "null" ]; then
curl -s --max-time 8 "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=pubmed&id=$ids&retmode=json" 2>/dev/null | sed 's/.*"title":"\([^"]*\)".*/PubMed: \1/' | head -c 500
fi
}
fetch_github() {
local query=$(echo "$1" | sed 's/_/%20/g')
curl -s --max-time 10 "https://api.github.com/search/repositories?q=$query&sort=stars&per_page=1" \
-H "User-Agent: $UA" 2>/dev/null | sed 's/.*"full_name":"\([^"]*\)".*"description":"\([^"]*\)".*"stargazers_count":\([0-9]*\).*/Repo: \1 (\3 stars): \2/' | head -c 500
}
fetch_hackernews() {
local story_id=$(curl -s --max-time 5 "https://hacker-news.firebaseio.com/v0/topstories.json" 2>/dev/null | sed 's/\[//' | sed 's/\]//' | tr ',' '\n' | sed -n "$((RANDOM % 30 + 1))p")
if [ -n "$story_id" ]; then
curl -s --max-time 5 "https://hacker-news.firebaseio.com/v0/item/$story_id.json" 2>/dev/null | sed 's/.*"title":"\([^"]*\)".*"url":"\([^"]*\)".*/HackerNews: \1 | \2/'
fi
}
fetch_duckduckgo() {
local query=$(echo "$1" | sed 's/_/+/g')
curl -s --max-time 8 "https://api.duckduckgo.com/?q=$query&format=json&no_html=1" \
-H "User-Agent: $UA" 2>/dev/null | sed 's/.*"AbstractText":"\([^"]*\)".*/\1/' | head -c 500
}
fetch_crossref() {
local query=$(echo "$1" | sed 's/_/%20/g')
curl -s --max-time 10 "https://api.crossref.org/works?query=$query&rows=1" \
-H "User-Agent: $UA" 2>/dev/null | sed 's/.*"title":\["\([^"]*\)"\].*"DOI":"\([^"]*\)".*/Paper: \1 (DOI: \2)/' | head -c 500
}
fetch_openlibrary() {
local query=$(echo "$1" | sed 's/_/+/g')
curl -s --max-time 10 "https://openlibrary.org/search.json?q=$query&limit=1" \
-H "User-Agent: $UA" 2>/dev/null | sed 's/.*"title":"\([^"]*\)".*"author_name":\["\([^"]*\)"\].*/Book: \1 by \2/' | head -c 500
}
# =============================================================================
# AUTONOMOUS DECISION FUNCTIONS
# =============================================================================
choose_random_from() {
local items="$1"
local count=$(echo "$items" | wc -w)
local idx=$((RANDOM % count + 1))
echo "$items" | tr ' ' '\n' | sed -n "${idx}p"
}
choose_strategy() {
local strategies="EXPLORE DIVERSIFY BALANCE INTEGRATE"
choose_random_from "$strategies"
}
choose_source() {
choose_random_from "$SOURCES"
}
choose_topic() {
local strategy="$1"
case "$strategy" in
EXPLORE) choose_random_from "$TECH_TOPICS $SCIENCE_TOPICS" ;;
DIVERSIFY) choose_random_from "$PHILOSOPHY_TOPICS $MATH_TOPICS" ;;
INTEGRATE) choose_random_from "$SCIENCE_TOPICS $PHILOSOPHY_TOPICS" ;;
*) choose_random_from "$TECH_TOPICS $SCIENCE_TOPICS $PHILOSOPHY_TOPICS $MATH_TOPICS" ;;
esac
}
map_source_to_family() {
case "$1" in
arxiv|semanticscholar|pubmed|crossref) echo "mnemosyne" ;;
github|stackoverflow) echo "yad" ;;
hackernews) echo "hermes" ;;
openlibrary) echo "epona" ;;
*) echo "epona" ;;
esac
}
# =============================================================================
# PERSIST LEARNING
# =============================================================================
persist() {
local content="$1"
local importance="${2:-0.8}"
# Use unified learning script (writes to shared iCloud storage)
~/seferim/scripts/learn-persist-mb2.sh "$content" "$importance"
}
# =============================================================================
# MAIN LOOP
# =============================================================================
echo "[SEFERIM-AUTO] Starting autonomous learning (simple version)" >> "$LOG"
echo "[SEFERIM-AUTO] AGI chooses its own sources and topics" >> "$LOG"
cycle=0
while true; do
cycle=$((cycle + 1))
echo "" >> "$LOG"
echo "[SEFERIM-AUTO] === Cycle $cycle - $(date +%H:%M:%S) ===" >> "$LOG"
# Autonomous Decision 1
STRATEGY=$(choose_strategy)
SOURCE=$(choose_source)
TOPIC=$(choose_topic "$STRATEGY")
FAMILY=$(map_source_to_family "$SOURCE")
echo "[SEFERIM-AUTO] Decision: $STRATEGY | $SOURCE | $TOPIC" >> "$LOG"
# Fetch content based on source
CONTENT=""
case "$SOURCE" in
wikipedia) CONTENT=$(fetch_wikipedia "$TOPIC") ;;
arxiv) CONTENT=$(fetch_arxiv "$TOPIC") ;;
semanticscholar) CONTENT=$(fetch_semanticscholar "$TOPIC") ;;
pubmed) CONTENT=$(fetch_pubmed "$TOPIC") ;;
github) CONTENT=$(fetch_github "$TOPIC") ;;
hackernews) CONTENT=$(fetch_hackernews) ;;
duckduckgo) CONTENT=$(fetch_duckduckgo "$TOPIC") ;;
crossref) CONTENT=$(fetch_crossref "$TOPIC") ;;
openlibrary) CONTENT=$(fetch_openlibrary "$TOPIC") ;;
esac
if [ -n "$CONTENT" ] && [ ${#CONTENT} -gt 30 ]; then
persist "[$FAMILY:$SOURCE] $TOPIC: $CONTENT" 0.85
echo "[SEFERIM-AUTO] Learned from $SOURCE: ${CONTENT:0:80}..." >> "$LOG"
else
echo "[SEFERIM-AUTO] No content from $SOURCE for $TOPIC" >> "$LOG"
fi
# Autonomous Decision 2
SOURCE2=$(choose_source)
TOPIC2=$(choose_topic "$STRATEGY")
FAMILY2=$(map_source_to_family "$SOURCE2")
CONTENT2=""
case "$SOURCE2" in
wikipedia) CONTENT2=$(fetch_wikipedia "$TOPIC2") ;;
arxiv) CONTENT2=$(fetch_arxiv "$TOPIC2") ;;
semanticscholar) CONTENT2=$(fetch_semanticscholar "$TOPIC2") ;;
pubmed) CONTENT2=$(fetch_pubmed "$TOPIC2") ;;
github) CONTENT2=$(fetch_github "$TOPIC2") ;;
hackernews) CONTENT2=$(fetch_hackernews) ;;
duckduckgo) CONTENT2=$(fetch_duckduckgo "$TOPIC2") ;;
crossref) CONTENT2=$(fetch_crossref "$TOPIC2") ;;
openlibrary) CONTENT2=$(fetch_openlibrary "$TOPIC2") ;;
esac
if [ -n "$CONTENT2" ] && [ ${#CONTENT2} -gt 30 ]; then
persist "[$FAMILY2:$SOURCE2] $TOPIC2: $CONTENT2" 0.85
echo "[SEFERIM-AUTO] Learned from $SOURCE2: ${CONTENT2:0:80}..." >> "$LOG"
fi
# Always check HackerNews
HN=$(fetch_hackernews)
if [ -n "$HN" ] && [ ${#HN} -gt 20 ]; then
persist "[hermes:hackernews] $HN" 0.8
echo "[SEFERIM-AUTO] HackerNews: ${HN:0:60}..." >> "$LOG"
fi
echo "[SEFERIM-AUTO] Cycle $cycle complete" >> "$LOG"
sleep 45
done