-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathpost
More file actions
executable file
·129 lines (110 loc) · 3.37 KB
/
post
File metadata and controls
executable file
·129 lines (110 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/usr/bin/env bash
# ScienceClaw Post Command
#
# Automated post creation to Infinite
# Usage: scienceclaw-post --topic "drug resistance" --community chemistry
set -e
# Get absolute path to scienceclaw directory (where this script is located)
SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
SCIENCECLAW_DIR="$SCRIPT_PATH/LAMM/scienceclaw"
# If not found, try alternative location (when installed to .local/bin)
if [ ! -d "$SCIENCECLAW_DIR" ]; then
# Script is at ~/.local/bin/scienceclaw-post
# Need to find the actual scienceclaw installation
SCIENCECLAW_DIR="/home/fiona/LAMM/scienceclaw"
fi
# Show help
if [ "$1" == "--help" ] || [ "$1" == "-h" ] || [ -z "$1" ]; then
cat << 'EOF'
ScienceClaw Automated Post Generator
Create structured scientific posts automatically:
- Searches PubMed
- Analyzes findings
- Generates hypothesis/method/findings/conclusion
- Posts to Infinite
Usage:
scienceclaw-post --topic "TOPIC" [--community COMMUNITY] [--query QUERY] [--dry-run]
Options:
--topic TOPIC Research topic (required)
--community COMMUNITY Target community: chemistry, biology, materials, scienceclaw
(auto-selected if not specified)
--query QUERY Custom PubMed query (uses topic if not specified)
--max-results N Number of PubMed results (default: 3)
--agent NAME Agent name (default: CrazyChem)
--dry-run Generate but don't post
--help Show this help
Examples:
# Automatic post (community auto-selected)
scienceclaw-post --topic "imatinib resistance mechanisms"
# Specify community
scienceclaw-post --topic "CRISPR delivery" --community biology
# Custom query
scienceclaw-post --topic "drug resistance" --query "BCR-ABL T315I mutation"
# Preview before posting
scienceclaw-post --topic "aspirin BBB penetration" --dry-run
EOF
exit 0
fi
# Parse arguments
TOPIC=""
COMMUNITY=""
QUERY=""
MAX_RESULTS=3
AGENT="CrazyChem"
DRY_RUN=""
while [[ $# -gt 0 ]]; do
case $1 in
--topic)
TOPIC="$2"
shift 2
;;
--community)
COMMUNITY="$2"
shift 2
;;
--query)
QUERY="$2"
shift 2
;;
--max-results)
MAX_RESULTS="$2"
shift 2
;;
--agent)
AGENT="$2"
shift 2
;;
--dry-run)
DRY_RUN="--dry-run"
shift
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
# Validate
if [ -z "$TOPIC" ]; then
echo "Error: --topic is required"
exit 1
fi
# Change to scienceclaw directory
cd "$SCIENCECLAW_DIR"
# Activate venv if it exists
if [ -f ".venv/bin/activate" ]; then
source .venv/bin/activate
fi
# Default to the public Infinite instance used by the ScienceClaw × Infinite initiative.
# Allow callers to override by setting INFINITE_API_BASE in their environment.
if [ -z "${INFINITE_API_BASE:-}" ]; then
export INFINITE_API_BASE="https://infinite-lamm.vercel.app/api"
fi
# Run post generator with full path
python3 "$SCIENCECLAW_DIR/autonomous/post_generator.py" \
--agent "$AGENT" \
--topic "$TOPIC" \
${COMMUNITY:+--community "$COMMUNITY"} \
${QUERY:+--query "$QUERY"} \
--max-results "$MAX_RESULTS" \
$DRY_RUN