npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

imessagegpt

v0.0.1

Published

Ask GPT questions about your iMessage history

Downloads

7

Readme

iMessageGPT

Ask GPT questions about your iMessage history.

https://www.youtube.com/watch?v=ABdvXmSXd94

Installation

$ npm i -g imessagegpt

Verify installation with:

$ imsg --help

Usage

  1. Set up permissions

Allow terminal access to ~/Library/Messages/chat.db, which is where iMessages are stored. From System Preferences > Security & Privacy > Privacy > Full Disk Access, allow "full disk access" for your terminal. See this video for a demonstration of how to do this.

  1. Create config file

Now, initialize your config directory with imsg config init. Pass in your OpenAI api key to the --openAIApiKey or -k flag. You will be prompted a for your name, which will the LLM will use to distinguish you and the other person in the chat. The config directory will be stored at ~/.imessagegpt.

$ imsg config init -k "key"

What is your name?: John
Created config file at /Users/25John/.imessagegpt/config.json

The chat model configured gpt-4-1106-preview. If you are on the free OpenAI tier you will have to pass in a chat model parameter:

$ imsg config init -k "key" --chatModel gpt-3.5-turbo  

By default, gpt-4-1106-preview model is used for chat and text-embedding-ada-002 is used for embeddings. If you would like to use different models use the --chatModel and --embeddingsModel flags.

  1. Scan the chat

Next, scan the chat you would like to query with imsg chat scan. You will be prompted the name of the other person in the chat, used by the LLM to distinguish the two members of the chat. You will be prompted to enter a message that the other person in the chat has sent, to retrieve their iMessage handle ID for your system.

You will then be asked to describe the relationship between you and the other person, passed as context into the LLM. The relationship description should be in third person, as shown. The more detailed your description is, the better the LLM performs.

This command reads the chat.db file, builds a USearch index, and saves it into the config directory.

$ imsg chat scan

What is the other person's name?: Sarah
What is the relationship between John and Sarah?: John and Sarah are friends from high school.
Enter a message Sarah sent to you: You free for lunch tomorrow at 2? 

Are you referring to this message:
	On 2023-11-14 22:44:58:
	"You free for lunch tomorrow at 2?"
 
Type (y/n): y

Scanning... done
Chat scanned and saved. Run `imsg chat analyze Sarah` or `imsg chat ask Sarah` to query.
  1. Query the chat

Ask questions about your chat history with imsg chat ask. Pass in the name specified in the scan command (case sensitive).

$ imsg chat ask "Sarah"    # query chat with Sarah

Prompt: Describe the relationship between John and Sarah.

Answer:
John and Sarah share a complex and dynamic relationship that borders on a close friendship...

You can now scan other chats and ask about them too!

For more detailed answers, use the gpt-4-1106-preview chat model. For faster answers, use gpt-3.5-turbo.

Usage

$ npm install -g imessagegpt
$ imsg COMMAND
running command...
$ imsg (--version)
imessagegpt/0.0.1 darwin-x64 node-v21.5.0
$ imsg --help [COMMAND]
USAGE
  $ imsg COMMAND
...

Commands

imsg chat analyze NAME

Gives a general overview of a chat

USAGE
  $ imsg chat analyze NAME

ARGUMENTS
  NAME  Name of the person in the chat

DESCRIPTION
  Gives a general overview of a chat

EXAMPLES
  $ imsg chat analyze "John"

See code: src/commands/chat/analyze.ts

imsg chat ask NAME

Ask a question about a chat

USAGE
  $ imsg chat ask NAME

ARGUMENTS
  NAME  Name of the person in the chat

DESCRIPTION
  Ask a question about a chat

EXAMPLES
  $ imsg chat ask "John"

See code: src/commands/chat/ask.ts

imsg chat delete NAME

Deletes a chat that has been scanned

USAGE
  $ imsg chat delete NAME

ARGUMENTS
  NAME  Name of the person in the chat

DESCRIPTION
  Deletes a chat that has been scanned

EXAMPLES
  $ imsg chat delete "John"

See code: src/commands/chat/delete.ts

imsg chat list

Lists all chats that have been scanned

USAGE
  $ imsg chat list

DESCRIPTION
  Lists all chats that have been scanned

EXAMPLES
  $ imsg chat list

See code: src/commands/chat/list.ts

imsg chat scan

Scans a chat and stores its data

USAGE
  $ imsg chat scan [-d <value>]

FLAGS
  -d, --chatDb=<value>  [default: /Users/25aaravb/Library/Messages/chat.db] Path of .db file containing messages

DESCRIPTION
  Scans a chat and stores its data

EXAMPLES
  $ imsg chat scan

See code: src/commands/chat/scan.ts

imsg config init

Creates a configuration directory

USAGE
  $ imsg config init -k <value> [-a <value>] [-r <value>] [-l <value>] [-e <value>] [-c <value>]

FLAGS
  -a, --openAiApiKey=<value>
  -c, --chatModel=<value>        [default: gpt-4-1106-preview] OpenAI model used for chat
  -e, --embeddingsModel=<value>  [default: text-embedding-ada-002] OpenAI model used for embeddings
  -k, --openAIApiKey=<value>     (required) API key for OpenAI
  -l, --leafCount=<value>        [default: 100] Number of messages around each root to use for conversation context
  -r, --rootCount=<value>        [default: 5] Number of roots

DESCRIPTION
  Creates a configuration directory

EXAMPLES
  $ imsg config init -k "openai apikey"

See code: src/commands/config/init.ts

imsg help [COMMANDS]

Display help for imsg.

USAGE
  $ imsg help [COMMANDS] [-n]

ARGUMENTS
  COMMANDS  Command to show help for.

FLAGS
  -n, --nested-commands  Include all nested commands in the output.

DESCRIPTION
  Display help for imsg.

See code: @oclif/plugin-help