Skip to content

Commit 3d7d39b

Browse files
committed
refine the log
1 parent d80a7ce commit 3d7d39b

File tree

11 files changed

+31
-30
lines changed

11 files changed

+31
-30
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ SLEEPLESS_LOG_DIR=workspace/.logs
314314

315315
The agent intelligently processes different task types:
316316

317-
1. **Random Thoughts** - Auto-commits to `random-ideas` branch
317+
1. **Thoughts** - Auto-commits to `thought-ideas` branch
318318
```
319319
/think Research async patterns in Rust
320320
/think What's the best way to implement caching?
@@ -425,10 +425,10 @@ launchctl list | grep sleepless
425425

426426
## Performance Tips
427427

428-
1. **Use random thoughts to fill idle time** - Maximizes usage
428+
1. **Use thoughts to fill idle time** - Maximizes usage
429429
2. **Batch serious jobs** - Reduces context switching
430430
3. **Monitor credits** - Watch scheduler logs for window resets
431-
4. **Review git history** - Check `random-ideas` branch regularly
431+
4. **Review git history** - Check `thought-ideas` branch regularly
432432
5. **Check metrics** - Run `sle check` to track performance
433433

434434
## Security Notes

src/sleepless_agent/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ claude_code:
99

1010
git:
1111
use_remote_repo: true
12-
remote_repo_url: [email protected]:TimeLovercc/sleepless-agent.git
12+
remote_repo_url: [email protected]:TimeLovercc/test1.git
1313
auto_create_repo: true
1414

1515
agent:

src/sleepless_agent/core/daemon.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def _create_seed_task_if_needed(self) -> None:
189189

190190
self.task_queue.add_task(
191191
description=seed_description,
192-
priority=TaskPriority.RANDOM,
192+
priority=TaskPriority.THOUGHT,
193193
)
194194

195195
try:

src/sleepless_agent/core/executor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ def _ensure_readme_exists(self, workspace: Path, task_id: int, task_description:
240240
TASK_ID=task_id,
241241
TASK_TITLE=task_description[:50],
242242
TASK_DESCRIPTION=task_description,
243-
PRIORITY="serious" if project_id else "random",
244-
PRIORITY_LABEL="SERIOUS" if project_id else "RANDOM",
243+
PRIORITY="serious" if project_id else "thought",
244+
PRIORITY_LABEL="SERIOUS" if project_id else "THOUGHT",
245245
PROJECT_NAME=project_name or "None",
246246
CREATED_AT=datetime.now(timezone.utc).replace(tzinfo=None).isoformat(),
247247
)
@@ -1171,7 +1171,7 @@ async def execute_task(
11711171
task_id: int,
11721172
description: str,
11731173
task_type: str = "general",
1174-
priority: str = "random",
1174+
priority: str = "thought",
11751175
timeout: Optional[int] = None,
11761176
project_id: Optional[str] = None,
11771177
project_name: Optional[str] = None,
@@ -1183,7 +1183,7 @@ async def execute_task(
11831183
task_id: Task ID
11841184
description: Task description/prompt
11851185
task_type: Type of task (code, research, brainstorm, etc.)
1186-
priority: Task priority (random or serious)
1186+
priority: Task priority (thought or serious)
11871187
timeout: Timeout in seconds (not directly supported by SDK)
11881188
project_id: Optional project ID for shared workspace
11891189
project_name: Optional project name (for logging)

src/sleepless_agent/core/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
class TaskPriority(str, Enum):
1515
"""Task priority levels"""
16-
RANDOM = "random" # Low priority, experimental
16+
THOUGHT = "thought" # Low priority, experimental
1717
SERIOUS = "serious" # High priority, needs completion
1818
GENERATED = "generated" # Auto-generated backlog filler
1919

@@ -46,7 +46,7 @@ class Task(Base):
4646
validate_strings=True,
4747
create_constraint=False,
4848
),
49-
default=TaskPriority.RANDOM,
49+
default=TaskPriority.THOUGHT,
5050
nullable=False,
5151
)
5252
task_type = Column(
@@ -183,7 +183,7 @@ class TaskPool(Base):
183183
validate_strings=True,
184184
create_constraint=False,
185185
),
186-
default=TaskPriority.RANDOM,
186+
default=TaskPriority.THOUGHT,
187187
nullable=False,
188188
)
189189
category = Column(String(100), nullable=True)

src/sleepless_agent/core/queue.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def get_pool_status(self) -> dict:
4242
def add_task(
4343
self,
4444
description: str,
45-
priority: TaskPriority = TaskPriority.RANDOM,
45+
priority: TaskPriority = TaskPriority.THOUGHT,
4646
context: Optional[dict] = None,
4747
slack_user_id: Optional[str] = None,
4848
slack_thread_ts: Optional[str] = None,
@@ -84,7 +84,7 @@ def get_pending_tasks(self, limit: int = 10) -> List[Task]:
8484
def _op(session: Session) -> List[Task]:
8585
priority_order = case(
8686
(Task.priority == TaskPriority.SERIOUS.value, 0),
87-
(Task.priority == TaskPriority.RANDOM.value, 1),
87+
(Task.priority == TaskPriority.THOUGHT.value, 1),
8888
else_=2,
8989
)
9090
return (

src/sleepless_agent/core/task_runtime.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ async def execute(self, task) -> None:
7171

7272
self.task_queue.mark_in_progress(task.id)
7373

74+
task_log.info("=" * 80)
7475
task_log.info(
7576
"task.start",
7677
description=task.description,
@@ -250,7 +251,7 @@ def _maybe_commit_changes(
250251
) -> Optional[str]:
251252
files_for_commit: Set[str] = set(files_modified or [])
252253

253-
if task.priority in (TaskPriority.RANDOM, TaskPriority.GENERATED):
254+
if task.priority in (TaskPriority.THOUGHT, TaskPriority.GENERATED):
254255
if not files_for_commit:
255256
summary_rel_path = self.git.write_summary_file(
256257
workspace_path=workspace,
@@ -434,7 +435,7 @@ def _log_success_metrics(
434435
try:
435436
priority_icon = {
436437
TaskPriority.SERIOUS: "🔴",
437-
TaskPriority.RANDOM: "🟡",
438+
TaskPriority.THOUGHT: "🟡",
438439
TaskPriority.GENERATED: "🟢",
439440
}.get(task.priority, "ℹ️")
440441

src/sleepless_agent/interfaces/bot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def handle_think_command(
177177

178178
self._create_task(
179179
description=cleaned_description,
180-
priority=TaskPriority.RANDOM,
180+
priority=TaskPriority.THOUGHT,
181181
response_url=response_url,
182182
user_id=user_id,
183183
note=helper_note,
@@ -207,7 +207,7 @@ def _create_task(
207207

208208
if priority == TaskPriority.SERIOUS:
209209
priority_label = "🔴 Serious task"
210-
elif priority == TaskPriority.RANDOM:
210+
elif priority == TaskPriority.THOUGHT:
211211
priority_label = "🟡 Thought"
212212
else:
213213
priority_label = "🟢 Generated task"

src/sleepless_agent/interfaces/cli.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def command_task(ctx: CLIContext, description: str, priority: TaskPriority, proj
103103
)
104104
if priority == TaskPriority.SERIOUS:
105105
label = "Serious"
106-
elif priority == TaskPriority.RANDOM:
106+
elif priority == TaskPriority.THOUGHT:
107107
label = "Thought"
108108
else:
109109
label = "Generated"
@@ -462,7 +462,7 @@ def command_check(ctx: CLIContext) -> int:
462462
priority_display = f"[red bold]{label}[/]"
463463
elif priority_value == TaskPriority.GENERATED.value:
464464
priority_display = f"[magenta]{label}[/]"
465-
elif priority_value == TaskPriority.RANDOM.value:
465+
elif priority_value == TaskPriority.THOUGHT.value:
466466
priority_display = f"[cyan]{label}[/]"
467467
else:
468468
priority_display = label
@@ -840,12 +840,12 @@ def build_parser() -> argparse.ArgumentParser:
840840
subparsers = parser.add_subparsers(dest="command", required=True)
841841

842842
task_parser = subparsers.add_parser("task", help="Queue a serious task")
843-
task_parser.add_argument("description", nargs=argparse.REMAINDER, help="Task description")
844-
task_parser.add_argument("-p", "--project", help="Project name to associate with the task")
843+
task_parser.add_argument("-p", "--project", required=True, help="Project name to associate with the task (required)")
844+
task_parser.add_argument("description", nargs='+', help="Task description")
845845

846846
think_parser = subparsers.add_parser("think", help="Capture a random thought")
847-
think_parser.add_argument("description", nargs=argparse.REMAINDER, help="Thought description")
848-
think_parser.add_argument("-p", "--project", help="Project name to associate with the thought")
847+
think_parser.add_argument("-p", "--project", required=True, help="Project name to associate with the thought (required)")
848+
think_parser.add_argument("description", nargs='+', help="Thought description")
849849

850850
subparsers.add_parser("check", help="Show comprehensive system overview with rich output")
851851

@@ -883,7 +883,7 @@ def main(argv: Optional[list[str]] = None) -> int:
883883
description = " ".join(args.description).strip()
884884
if not description:
885885
parser.error("think requires a description")
886-
return command_task(ctx, description, TaskPriority.RANDOM, args.project)
886+
return command_task(ctx, description, TaskPriority.THOUGHT, args.project)
887887

888888
if args.command == "check":
889889
return command_check(ctx)

src/sleepless_agent/scheduling/scheduler.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ def get_next_tasks(self) -> List[Task]:
463463
def schedule_task(
464464
self,
465465
description: str,
466-
priority: TaskPriority = TaskPriority.RANDOM,
466+
priority: TaskPriority = TaskPriority.THOUGHT,
467467
project_id: Optional[str] = None,
468468
project_name: Optional[str] = None,
469469
) -> Task:
@@ -484,11 +484,11 @@ def schedule_task(
484484
priority="serious",
485485
project=project_name,
486486
)
487-
elif priority == TaskPriority.RANDOM:
487+
elif priority == TaskPriority.THOUGHT:
488488
logger.info(
489489
"scheduler.task.scheduled",
490490
task_id=task.id,
491-
priority="random",
491+
priority="thought",
492492
project=project_name,
493493
)
494494
else:
@@ -601,7 +601,7 @@ def estimate_task_priority_score(self, task: Task) -> float:
601601
# Priority multiplier
602602
if task.priority == TaskPriority.SERIOUS:
603603
score += 1000
604-
elif task.priority == TaskPriority.RANDOM:
604+
elif task.priority == TaskPriority.THOUGHT:
605605
score += 100
606606
elif task.priority == TaskPriority.GENERATED:
607607
score += 10

0 commit comments

Comments
 (0)