Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add tips of the day for new sessions #42

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions src/goose/cli/session.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import traceback
from pathlib import Path
from typing import Any, Dict, List, Optional
import random

from exchange import Message, ToolResult, ToolUse, Text
from prompt_toolkit.shortcuts import confirm
Expand All @@ -27,6 +28,30 @@
RESUME_MESSAGE = "I see we were interrupted. How can I help you?"


TIPS = [

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did Goose write these tips? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no... in this case genuine human

"Tell goose how to run tests so it can verify any changes. eg 'please run make test to verify any changes'",
"Tell goose if you have any developer docs like CONTRIBUTING.md so it can learn how to build and help you.",
"Goose likes to know what programming language you are working in to get started.",
"You can ask goose to confirm commands with you if you like.",
"Try this: 'In this golang project, I want you to add open telemetry to help me get "
+ "started with it. run the `just test` command to check things work.'",
"If you are working in a git repo, you can stage and commit changes "
+ "(or ask goose to) as you go to not loose any work.",
"You can ask goose to try almost any task, "
+ "it likes to write and execute scripts as well as help you sort out your environment.",
"Tell goose what directories you want to work in (this can be your main directory, "
+ "but you can tell it to look elsewhere it needs to)",
"With the screen toolkit, goose can look at your screen and help you make visual changes.",
"You can run more than one goose at a time (in different terminals or IDEs).",
"Ask goose to write a unit test for some code and check it works.",
"Ask goose to add some new feature or function by telling it to look at similar existing functionality.",
"You can use goose to analyse data as well, it can write scripts and evaluate them against your data.",
"Ask goose to recommend a tool to use, and it can offer to install it as well.",
"Start by asking goose to run your tests for you and it will report back.",
"If you have broken tests, ask goose to help you either fix the tests or the broken code.",
]


def load_provider() -> str:
# We try to infer a provider, by going in order of what will auth
providers = load_plugins(group="exchange.provider")
Expand Down Expand Up @@ -111,8 +136,14 @@ def __init__(
messages.append(Message.assistant(RESUME_MESSAGE))
self.exchange.messages.extend(messages)

if len(self.exchange.messages) == 0 and plan:
self.setup_plan(plan=plan)
if len(self.exchange.messages) == 0:
# Show tips of the day for new sessions
random_tips = random.sample(TIPS, k=2)
formatted_tips = "\n ".join(random_tips)
print(f"Tips of the day:\n [yellow]{formatted_tips}[/yellow]")

if plan:
self.setup_plan(plan=plan)

self.prompt_session = GoosePromptSession.create_prompt_session()

Expand Down
2 changes: 1 addition & 1 deletion src/goose/toolkit/developer.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Developer(Toolkit):

def system(self) -> str:
"""Retrieve system configuration details for developer"""
hints_path = Path('.goosehints')
hints_path = Path(".goosehints")
system_prompt = Message.load("prompts/developer.jinja").text
if hints_path.is_file():
goosehints = hints_path.read_text()
Expand Down
2 changes: 0 additions & 2 deletions tests/toolkit/test_developer.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,3 @@ def test_write_file(temp_dir, developer_toolkit):
content = "Hello World"
developer_toolkit.write_file(test_file.as_posix(), content)
assert test_file.read_text() == content